#avr | Logs for 2016-02-23

Back
[01:02:30] <WormFood> http://wormfood.net/avrbaudcalc-testing.php <-- what do you guys think about my changes? Still have a little more tweaking to do, but almost done.
[01:08:01] * Casper likes
[01:13:57] <WormFood> I think I'm gonna do away with the predefined list of clock speeds, and give the default list on the page, where they can change it to anything they want. Right now, if you enter 0 or 1 clock speed, it will still give you the internal list
[01:50:00] <theBear> pretty
[03:52:32] <cehteh> apropos reversing a byte: untested code: http://paste.debian.net/402727/
[03:52:59] <cehteh> compiles to 84 byte asm so far
[03:59:17] <mohsen_> Which module should I use for calculating the angle of rotation?
[04:02:01] <cehteh> module?
[04:04:00] <mohsen_> Yes, the ones that have different interfaces to provide data. like a gps module...
[04:04:16] <cehteh> sensor you mean
[04:04:21] <mohsen_> Yes yes
[04:04:28] <cehteh> gyroscope or magnetometer
[04:04:42] <cehteh> depends on the use
[04:05:09] <cehteh> accelerometer can do rotation on 2 axis
[04:05:51] <cehteh> usually one uses all three and does some clever fusion of the sensor data
[04:08:35] <jben> I have a strange behavior with (vsn)printf (linked with the printf_flt version)
[04:09:38] <jben> when, a is a float, and b a uint16_t, snprintf(zstr, zlen, "a=%f, b=%u",a,b) works
[04:09:48] <cehteh> GYRO = fast, but gives rates, may drift over time, only relative measurements, ACC = vibration sensitive, gives only a vector to center of gravity, absolute readings MAG = absolute reading, slow, lots of distortion
[04:10:20] <jben> but snprintf(zstr, zlen, "b=%u, a=%f",b,a) do not work (I have 0.000 displayed for the float, or random value)
[04:10:38] <jben> do somebody have a idea ?
[04:10:50] <cehteh> maybe a bug? :D
[04:11:32] <cehteh> dont use floats on avr :D
[04:12:07] <cehteh> pastebin your code
[04:12:59] <jben> I have to use float. I am making a temperature control system, and I use a PID regulator.
[04:13:38] <jben> But my time step is 10 seconds, even float computation take time, I have a lot of time
[04:16:26] * cehteh did temperature control with pid in integer
[04:16:45] <cehteh> keeps temperature of an oven within 0.1°C or less
[04:17:52] <cehteh> have to check, iirc i didnt even need 32bit, 16bit integers are enough
[04:19:50] <jben> Yes I could, but the temperature is frome 40 m² of wine, and I use water flow to control the temperature, so it is NOT a quick system, so I have the time to compute on float.
[04:20:00] <mohsen_> cehteh: If a gyro gives outputs in deg/s, then isn't it possible to calculate the angle based on the duration of rotation?
[04:20:14] <Jartza> PID doesn't know or care about human interpretation of degrees
[04:20:20] <cehteh> i really dont see why you insist on floats ... but whatever :)
[04:20:21] <jben> But yes, returning the float on the debug interface with printf is a bad idea
[04:20:53] <Jartza> it's us humans who care about those decimals
[04:21:05] <jben> cehteh: I prefer to have user-readable constants that I can set on-fly with my RS-485 bus
[04:21:30] <cehteh> mohsen_: yes it is, but its limited to your calculation exactness and noise/error of the gyro, results will slowly drift
[04:21:40] <Jartza> but making calculations and displaying results is two different things and you can always make calculations as integers
[04:21:42] <cehteh> you need something to recalibrate it to absolute angles
[04:22:00] <julius> hi
[04:22:26] <cehteh> jben: as Jartza says .. make your calculation simple and safe .. presenting that to the user is something completely different
[04:22:52] <jben> float are not safe in the avr-libc?
[04:23:21] <Jartza> did you know that you could represent 28.345 degrees as integer of value 28345 :)
[04:23:27] <cehteh> dunno i never used them, most problems come from people who use floats wronf
[04:23:28] <Jartza> as long as you know that the last 3 digits are the decimals
[04:23:28] <cehteh> g
[04:23:46] <Jartza> it's just matter of printing (and parsing the user input) but still no floats are needed
[04:24:00] <cehteh> but there may be as well some bugs in the lib because its rarely used
[04:24:11] <cehteh> you can use fixed point math
[04:24:12] <Jartza> and floats on avr are BLOAT
[04:24:21] <Jartza> because there's no FPU
[04:24:31] <Jartza> slow and bloated
[04:25:30] <Haohmaru> they bloat, they aaall bloat
[04:25:35] <cehteh> make all calculations in 1/100 °C .. thats easy to handle
[04:25:58] <cehteh> and even in 16 bit you have a lot headroom for calculations
[04:26:38] <cehteh> fixed point ftw, for the lazy do it in base10
[04:26:53] <cehteh> pro's do fixedpoint in base2
[04:27:46] <cehteh> displaying it to the user is then just inserting the decimal point at the right place ..
[04:30:35] <cehteh> Jartza: seen the byte-reverse above? .. just a fast try, not optimized but shoud be useable as is
[04:30:57] <jben> Yes I had already made some computation with integers and fixed point methods (in base2), but I was using more than one multiplication per second as now.
[04:31:05] <Jartza> cehteh: hmm?
[04:31:13] <Jartza> I might've missed that
[04:31:24] <cehteh> http://paste.debian.net/402727/
[04:31:32] <Jartza> ahh
[04:31:51] <cehteh> compiles to quite decent asm with -Os
[04:32:29] <Jartza> http://pastie.org/10733923
[04:32:32] <Jartza> that's 6 opcodes
[04:32:33] <Jartza> :)
[04:32:40] <cehteh> typo in that paste, needs rnibble->r2nibble in the rbyte func
[04:33:20] <cehteh> yes but loops, much slower
[04:34:30] <Jartza> http://pastie.org/10733927
[04:34:31] <cehteh> (or maybe not .. 8 iterations arent much :D ... I should test that)
[04:34:32] <Jartza> unroll it
[04:34:38] <Jartza> 16 cycles
[04:34:51] <cehteh> yes
[04:35:24] <cehteh> ok
[04:35:30] <cehteh> guess you won
[04:35:32] <Jartza> that's half a million reversals a second if running @8MHz internal clock :)
[04:35:48] <Jartza> but if tight on flash, then the loop is just fine :)
[04:36:25] <cehteh> ror/rol rotate into some carry flag?
[04:36:38] <jben> With the time constant I have, if I want to do fixed point code, I must have 1e-5'C precision
[04:36:42] <Jartza> cehteh: yeah
[04:37:03] <Jartza> http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_ROL.html
[04:37:03] <cehteh> jben: huh?
[04:37:15] <cehteh> jben: i somewhat doubt that
[04:37:45] <jben> cehteh: if I want my accumulaor for the I in my corrector accumulate something
[04:37:46] <cehteh> my oven controller has a 10 sec cycle too and runs very precise on 16bit ints
[04:38:14] <jben> cehteh: yes but you don't have "a hour" time constant in you PID
[04:38:23] <cehteh> you want to limit I anyway, possibly add some feed-forward and do a cascaded control loop
[04:39:17] <cehteh> i also wanted to experiment with logarithmic I and exponential D components someday
[04:39:28] <cehteh> but not needed for the oven
[04:39:41] <cehteh> actually i use only PI ,, D not needed
[04:40:09] <jben> the problem for me, is the time constant is long, and my min step size for input temperature is 1/16 precision
[04:40:30] <cehteh> dont let your I run away
[04:40:58] <cehteh> add some feedforward parallel to the PID controller
[04:41:00] <jben> so for a time step of 5s, the min step for my accumulator is 1/(3600/5)*1/16
[04:41:18] <jben> but, with int32, it will be fine
[04:41:27] <cehteh> you can tune this feedforward from I (minimize I, move that part over to the feedfoward)
[04:41:58] <cehteh> what do you heat? air? wine? what kind of heater?
[04:42:30] <cehteh> the absolute biggest improvement on regulation was when i implemented the cascaded controller, i'd really recommend that to you
[04:43:03] <Jartza> 11:54 < jben> Yes I could, but the temperature is frome 40 m² of wine, and I use water flow to control the temperature, so it is NOT a quick system, so I have the time to compute on float.
[04:43:14] <cehteh> ok
[04:43:23] <cehteh> you know about cascaded pid's?
[04:43:46] <jben> not necessary, my system is SLOW
[04:43:55] <cehteh> thats *why* you should use that
[04:44:18] <jben> and the fact is, a mistake, and it is nnnn € which are loose
[04:44:33] <cehteh> yes .. thats why i recommend that for you
[04:44:48] <cehteh> much less chance of oscillations and overshoots
[04:45:36] <jben> last year, I tested a PI on only one shot (one time 40m²), (when I wrote PID before, it was PID with D=0), it was working fine
[04:45:52] <cehteh> ok
[04:47:18] <jben> And I already use a cascaded PID
[04:47:28] <cehteh> well in short: i have 2 sensores, one ambient in the oven, one directly at the heating element .. the ambient sensor's PID regulates the setpoint (temperature) the heating element should have, and the pid at the heating element regulates the power
[04:47:32] <cehteh> ah ok
[04:48:43] <jben> in fact, the PID I actually speacking is constroling the calories flow, and to control the calories flow I use a PID which control the water flow, and to control the waterflow, I use a PID which control a motorized valve
[04:48:52] <cehteh> yes then its ok
[04:48:56] <jben> if it is what you mean by cascading PID
[04:49:10] <cehteh> thats what i meant
[04:49:54] <jben> the PID for controling the motiruzed valve is already made only with integers (because it is high speed PI, it must adapt to change depending the pressure of the water)
[04:50:30] <cehteh> problem with such slow systems is that they are really a pita to tune because it needs a lot patience, when you aim for fast responsiviness w/overshoots .. but i guess you can just tune it a bit underregulated, make it slower than necessary but be on the safe side
[04:51:24] <cehteh> i dont know much about wine .. but i guess you want to avoid overtemperatures on all costs :)
[04:51:25] <jben> but the PID for controling the water flow, is medium speed (~5s) depending on the temperature of water and was implemented with floats, and the bigger one is very slow, implemented with floats
[04:51:38] <cehteh> yes
[04:52:08] <cehteh> i still dont think you need floats there, maybe you want 32 bit ints for more precision
[04:53:16] <jben> I am sure I can do it easily with int32, but, I was thinking it was easier to debug with float
[04:53:30] <jben> (but with printf problems on floats, I am not sure anymore)
[04:54:03] <cehteh> integers have a single discrete value and representation, i think thats easier to debug
[04:54:39] <cehteh> w/ floats you have different representations (as string) and you cant see how precise they are easily
[04:54:48] <jben> I agree, it was a pita last year, even when I am testing, I don't have the right to destroy 40 m² of wine!
[04:55:16] <cehteh> i'd test it with water first :D
[04:56:09] <jben> I don't need fast responsiviness, but I have to control overshoots, and my waterflow can not be higher than a limit (15L/min)
[04:56:14] <cehteh> and parallel to the PID implement some saftey functions, hardcoded limits which close the value and ring a alarm or whatever
[04:56:45] <jben> cehteh: I can't, because while the wine is fermenting, the wine is its own heating source
[04:56:47] <cehteh> make some plausibility tests etc
[04:56:59] <cehteh> so you are cooling, not heating?
[04:57:27] <jben> I had already a alarm, I already use last year, with hardcoded limit to ring, and to check the temperature and the waterflow
[04:57:37] <jben> cehteh: yes I'm only cooling
[04:57:41] <cehteh> ah ok
[04:58:30] <cehteh> well safety the other way around then? cooling to much down in emergency is better than overheating? dunno, you should know what the 'safe-mode' would be
[04:59:05] <jben> last year, my alarm ring, but it was the "water alarm" the PID regulator of the motorized valve was out, (not enough water pressus due to the a failure of the water pump, it was usefull to have a alarm)
[04:59:40] <cehteh> of course
[05:00:00] <jben> cehteh: the safe-mode is is T oustide [T1,T2], ring the alarm, I will make the decision myself with manual control
[05:01:17] <jben> if the temperature go to low or to high, you can have different actions to do depending of the status of the fermentation, so the alarm is the only good solution I think
[05:01:31] <cehteh> i'd add something like "if T is too high then open valve, if t is too low then close valve" saftey positions for the valve (where open and close may be redefined to some other positions by you)
[05:02:08] <cehteh> dunno if you are always available or if something bad can happen when the alarm rings, valve is in wrong position and you are out for a few hours
[05:02:57] <jben> I am always available, and the decision can be different depending of the density of the wine (the status of the fermentation),.
[05:03:54] <jben> My bedroom is at 150 meters (433 MHz transmission alarm), and it is 2 week a year,
[05:05:20] <cehteh> ok
[05:05:57] <jben> Last year I test with Mega, I had a lot of problems (constant of the PID, water problems…) but even with that, it wwas very nice to control the temperature. This year, I will control 16 cistern of 20-40m², but with Xmega.
[05:06:06] <jben> Xmega is so cool compared to Mega.
[05:06:49] <Haohmaru> yez
[05:06:56] <Haohmaru> xmega is much x, very mega
[05:55:59] <jben> afair, in C, right shift and left shift operators are implementation defined on signed int
[05:56:34] <jben> for AVR do you know if this is defined?
[05:58:44] <cehteh> huh?
[05:59:00] <hetii> Jo
[05:59:03] <cehteh> right shift on signed, pulls the sign
[05:59:04] <hetii> hi :)
[05:59:15] <cehteh> left shift is the same for signed and unsigned
[05:59:36] <cehteh> right shift on unsigned clears the highest bit
[05:59:49] <hetii> Q: what is a safe time to toggle pin when drive different IC in uS ?
[06:00:10] <cehteh> depends on the IC
[06:00:52] <cehteh> jben: that C implicitly does all arithmetic casted to int is sometimes confusing
[06:00:56] <hetii> ok but there should be some generic value that we can assume that is safe
[06:01:02] <cehteh> no
[06:01:21] <hetii> hmm
[06:01:33] <jben> cehteh: ok, so it is not the same behavior as my computer
[06:01:59] <cehteh> you likely need to cast the stuff to the desired type
[06:02:46] <jben> I need to do, a = b/(2^16), with a int32_t, so doing a = b<<16, will do a incorrect result
[06:02:55] <jben> (I mean >>)
[06:03:16] <jben> (a and b are int32_t)
[06:03:39] <cehteh> that should work
[06:03:55] <jben> so I have to do a = b/(((uint32_t)1)<<16)
[06:04:43] <jben> cehteh: b>>16 will compute b/2^16 for negative b?
[06:04:49] <cehteh> i meant smaller types are implicitly casted, ah and integer literals (like 1) are int you have to use 1L
[06:05:13] <cehteh> (in some cases)
[06:05:38] <jben> cehteh: yes I can remplace ((uint32_t)1), by 1UL
[06:06:27] <cehteh> is 2^16 constant there?
[06:07:06] <cehteh> i mean you could just write b>>16 or b/0xffffL
[06:07:13] <jben> cehteh: yes, I can write 1L<<16, the compiler will compute it
[06:07:27] <cehteh> err wrong me :D
[06:08:05] <cehteh> off by one
[06:08:28] <cehteh> b/0x10000L
[06:08:34] <cehteh> but anyway should be the same
[06:08:36] <jben> my question is if b negative, b>>16 will return same as b/(1L<<16) ?
[06:09:04] <jben> for positive, yes, I'm sure about it, but for negative...
[06:09:15] <cehteh> if the types are signed types then it should be the same
[06:09:33] <cehteh> so yes ... should work
[06:09:41] <jben> cehteh: ok, thx
[06:10:29] <jben> (and in all case, I prefer write 1L<<16 than write 0x10000L, but I don't know why)
[06:11:21] <cehteh> i'd try to avoid magic constants at all
[06:12:04] <cehteh> #define SOMETHING 0x10000L (or 1L<<16) and then b/SOMETHING
[06:12:50] <cehteh> but by myself i am not strict with that, falling back to use some magic contstants as well sometimes
[06:15:54] * Haohmaru spills a bag of magic constants in cehteh's feet
[06:16:42] <Haohmaru> oops ;P~
[06:18:17] <julius> hi
[06:21:11] <cehteh> hi
[06:21:18] <julius> can somebody translate COMnx1:0 = 2 into a bit mask like 00001111 ?
[06:21:30] <julius> is it 00000010
[06:21:57] <cehteh> depends on the register
[06:22:06] <cehteh> these are not always right aligned
[06:22:21] <Haohmaru> i think 1:0 means two bits, the lowest one (0) and the next one (1)
[06:22:25] <Haohmaru> so 0x03
[06:22:28] <theBear> i can't workout wtf that is sposed to mean at all
[06:22:48] <cehteh> the datasheets use this notation
[06:23:07] <julius> its in TCCR1A from the atmega168
[06:23:19] <theBear> hmm, even the old ones (that i should know, as opposed to new ones that i only glanced at, maybe, by this stage)
[06:23:19] <cehteh> why 00001111?
[06:23:37] <julius> that was just a example, what kind of notation i was aiming for
[06:23:43] <theBear> i think 00001111 was just an example of a byte
[06:23:44] <julius> looks like its a 8bit register
[06:23:54] <theBear> heh, we know what a byte in binary means
[06:24:13] <julius> im sorry, that was just to make my sentence make more sense
[06:24:33] <theBear> hehe, i forgive you
[06:25:03] <Haohmaru> julius in the datasheet, there should be a wide but short table showing the 8 bits of the TCCR register
[06:25:22] <julius> yes got that
[06:25:32] <Haohmaru> there you will see which bits go to the COMn thing
[06:25:34] <cehteh> usually you build these by macros REGISTER = (1<<BIT01) | (1<<BIT00)
[06:25:49] <cehteh> there are macros for each bit
[06:26:08] <Haohmaru> xmega have dealt with that in a slightly better way ;]
[06:26:14] <julius> COMn are bit 6 and 7, so would COMn...1:0 = 2 be 10000000 ?
[06:26:39] <Haohmaru> probably
[06:26:57] <julius> Haohmaru, so whats 0x03?
[06:27:06] <cehteh> COM0A1 COM0A0 COM0B1 COM0B0
[06:27:07] <Haohmaru> so 1:0 means the setting is just two bits
[06:27:16] <cehteh> there are single macros for these bits
[06:27:20] <julius> i know
[06:27:24] <cehteh> use them
[06:27:24] <julius> and i use them
[06:27:26] <Haohmaru> julius no, if they are 7th and 6th bit, then 0xC0
[06:27:35] <julius> need to get the datasheet notation in my head too
[06:27:36] <Haohmaru> and 2 would be 0x40
[06:27:44] <Haohmaru> if my binary math is not broken
[06:28:07] <Haohmaru> uh, 0x80 i mean
[06:28:13] <Haohmaru> so yes, it's broken
[06:29:28] <julius> ah ok
[06:29:59] <cehteh> if in doubt, use some calculator :D .. or python
[06:30:03] <cehteh> >>> hex(0b10000000)
[06:30:03] <cehteh> '0x80'
[06:31:10] <Haohmaru> i use mIRC for that ;P~
[06:31:15] * Haohmaru hides
[06:31:29] <julius> i did
[06:31:36] <julius> the 0xc0 got me
[06:31:53] <julius> uh mirc, so youre a old school windows user ;)
[06:32:07] <cehteh> didnt know anyone still using mirc :D
[06:33:46] <Haohmaru> //echo -a $base(11000000,2,16)
[06:34:58] <cehteh> <Haohmaru> and 2 would be 0x40
[06:35:00] <cehteh> :D
[06:40:01] <Haohmaru> when you say 6th bit, are you counting them from 0 or from 1?
[06:40:02] <Haohmaru> ;P~
[06:44:49] <LeoNerd> I'd usually call 1<<5 the "6th" bit
[06:46:30] <cehteh> so linedit finished for now \o/ ... utf8 support and even a simple history (line recall) mode
[06:53:42] <julius> 0, i was talking about the one before the last 01000000
[06:53:44] <julius> on page 131 of the atmega168 doc theres a picture showing TCNTn, OCnX and some other values. couldnt they include OC1A/B in that?
[06:53:47] <julius> oh wait they did
[06:53:49] <julius> in non inverting mode, why is there a arrow hitting the OCnX line but the output stays high?
[06:58:05] <cehteh> because OCnA == TOP?
[06:59:20] <LeoNerd> o
[06:59:26] <LeoNerd> Er.. wait.. this isn't vim. <.<
[07:05:43] <julius> hehe, new line :)
[07:06:17] <julius> cehteh, so the compare never happens?
[07:19:17] <julius> great, my flux pen from china just arrived. after 40 days. a few days ago i bought one in germany
[07:20:59] <Lambda_Aurigae> http://shop.evilmadscientist.com/productsmenu/tinykitlist/652 I want!
[07:21:57] <Lambda_Aurigae> an attiny85 built like this might be fun too but probably the size of my 4x6 dining room table and then some.
[07:23:14] <julius> yup
[07:26:37] <LeoNerd> I think even an ATtiny85 built out of 4000-series logic chips would be house-sized
[07:27:27] <julius> that big?
[07:27:48] <julius> btw, you guys are native english speakers?
[07:27:49] <LeoNerd> Hrm.. Maybe room-sized
[07:27:53] <LeoNerd> I am
[07:28:36] <julius> yesterday i was watching a tv episode, in context a woman said "yes". but it sounded like "ya"
[07:28:59] <julius> is "ya" / "ja" something that exists in the english language?
[07:29:08] <julius> or was that slang
[07:29:34] <LeoNerd> Slang mostly.. it's not really an "official" thing... but it tends to come up a fair amount in casual spoken usagfe
[07:29:39] <LeoNerd> *usage
[07:32:16] <hetii> I wonder about legal aspect. If I port some driver source code for other platform then can I change license and just add comment that its based on other work that is under other license ?
[07:51:21] <jben> hetii: it is depending of the original licence of the "driver source code for other platform"
[07:53:55] <jben> Basicly, if it is BSD-{2,3,4}, MIT, apache... You can license the code you added with the licence you want, but you have to keep the original license for the original code (generally the only contraining rule is to keep the copyright line, and the disclamer).
[07:54:51] <jben> If it is LGPL-{2,3}, you can't change license, and you have to keep the original licence for your added code.
[07:56:04] <jben> If it is GPL-{2,3}, you have to keep the original licence, and you have to use the original licence even for code using the driver.
[08:20:18] <hetii> jben: ok thx
[08:36:14] <julius> how do you sleep with a 16mhz clock and a 8bit timer for 1 second? with prescalar 1024 it does 16000000/1024 = 15625 ticks per second, do you count up a software variable every 100milliseconds or something like that to get to 1s?
[08:37:52] <LeoNerd> I'd use software beyond that, yeah
[08:38:18] <LeoNerd> static uint16_t counter = 0; in the timer ISR, then increment it per tick and detect/reset it on that limit
[08:39:10] <theBear> count overflows
[08:39:21] <julius> ah yes
[08:40:58] <theBear> you can usually get away with using a overflow interrupt for it with minimal interrupt handler time added on and if you wish accounted for, tho actually, if the counter set to loop automatically that won't be an issue, the int handler will only have to increment some counter variable by one but the counter doesn't have to wait for that, and that will take infinitely less time to complete than another overflow
[08:43:59] <julius> now i just need the numbers. at 16mhz the cpu makes 15626 operations per second, so it takes 255 / 15626 = 0.163 seconds to count from 0 to 255?
[08:44:30] <theBear> umm, what ? where you get 15626 from ?
[08:46:47] <cehteh> julius: you should also expect spurious wakeups, unless you turned all other wakeup sources off
[08:47:21] <cehteh> any interrupt (uart) can wake it from sleep
[08:48:14] <julius> theBear, 16mhz / prescalar
[08:48:32] <julius> but this is probably right: (1/16000000) * 256 * 1024 = 0.0163s
[08:48:45] <julius> 16mhz, prescalar 1024, overflow every 0.0163s
[08:48:46] <cehteh> julius: you use emacs/orgmode?
[08:48:52] <julius> no, vim
[08:49:08] <cehteh> too bad .. i have this nice table for my timers :)
[08:50:40] <theBear> 16mhz/prescale is 16000, not 15626
[08:51:10] <julius> so 1000ms / 16 = 62.5 - pretty inaccurate but counting a var up to 62 would be almost a second then
[08:51:30] <julius> theBear, 16000000/1024 ?
[08:51:37] <theBear> oh, ok
[08:51:41] <theBear> sorry
[08:51:44] <julius> or was it 1000?
[08:51:45] <cehteh> 16.384 ms is correct for 8 bit overflow according to my table
[08:51:47] <theBear> ignore me, as you were
[08:51:55] <theBear> nah, pretty sure it's 1024
[08:52:03] <theBear> now you mention it
[08:52:05] <cehteh> 1024
[08:52:06] <julius> cehteh, yes got that here
[08:52:18] <cehteh> http://git.pipapo.org/?p=muos;a=blob;f=PLAN.org;h=7c254f9cd89bd351b29e78ec1fb4c637a009fe81;hb=9db3468e9828c60dc331972d9a81a16a94b6b24d#l81
[08:52:54] <theBear> and for less interrupting/counting, you can tune it down to the lowest resolution (in realtime) that you need to be able to get on the final round where you gonna be counting/looking for a specific value, rather than casually recording an overflow
[08:53:38] <julius> cehteh, looks nice...whats fullclock?
[08:53:46] <cehteh> my implementation details
[08:54:13] <julius> theBear, its for a frequency counter
[08:54:21] <theBear> and that would be i spose 16.384/256 (8bit) ms in this case, which means that you can have an accuracy of maximum that long from any absolute fraction of a second you might ideally desire
[08:54:22] <julius> would be nice to have exactly 1000ms
[08:54:42] <cehteh> i have one overflow counter (configureable, 16, 32, 64 bit) plus the hardware register (8 or 16 bit)
[08:54:50] <theBear> julius, ahh, in that case you probably want it as fast as you can get, so as to have more accuracy
[08:54:57] <cehteh> together they give a 24 to 80 bit counter for the time
[08:55:01] <julius> that was my thinking too
[08:55:42] <theBear> i wonder... i suppose ideally in a freq counter you would do anything you can to kinda pll your counting to the measured freq at any moment, knowing that if you got locked you would have the best possible accuracy
[08:55:58] <theBear> tho that's likely overkill for most, and certainly not something you see commonly in them
[08:56:25] <julius> i just count pulses for every second
[08:56:37] <julius> this is probably the time a 3.2768mHz crystal would be nice
[08:56:52] <cehteh> why?
[08:57:02] <LeoNerd> You can do it just fine with what you have
[08:57:14] <cehteh> you dont need to count exactly each second but can do the math then
[08:57:51] <LeoNerd> 16MHz prescaled by 16 gives 1MHz, count to 100. That's 10kHz. You can now count up to 10000 and get 1 second, with 0.1msec resolution.
[08:57:55] <LeoNerd> Er.. 0.01msec
[08:57:58] <theBear> i spose you can average over time also/instead, like use a comparator or pin interrupt to count the edges or one of the edges at least, and like the counter overflow, that will trigger/be available on the next clock cycle for you to count, regardless of what sub-clock-resolution it actually happened, then you can count those over a second or more, even have a running average i suppose (so the output/display is updated more than every X often long-time),
[08:57:59] <theBear> and divide the count over that longer period
[08:58:22] <theBear> hmmm, i think that should work out much more accurately than any soft counting/watching of the input signal
[08:58:48] <theBear> i wonder how you math the resolution that would achieve, that's a tricky one
[08:58:50] <cehteh> or add a hardware divider in front and use the capture unit
[08:59:06] <theBear> would also mean much less processing for the counting, giving potentially much higher max freq
[08:59:30] <theBear> hmm, freq divider, yeah, that should still work, just give you less things to count
[08:59:38] <theBear> aka ==better
[09:00:05] <cehteh> with the capture unit you can measure times very precisely
[09:00:49] <theBear> wait, what is the capture unit, you mean like comparator(-interrupt optionally) or some new thing i don't know
[09:01:19] <theBear> remember if you not counting over a long time, that a divider will divide your accuracy/res. by the same ammount
[09:01:23] <cehteh> instead counting ticks you do it the other way around, measure the timespan between lets say 1024 (hardware scaled) ticks
[09:01:47] <theBear> you might call it max error % more than accuracy or resolution
[09:02:28] <theBear> what, so the capture unit is a hardware assisted internal divider ?
[09:02:30] <cehteh> thes way i saied would scale better i think you can adjust the timer frequency to whatever precision you need
[09:02:38] <cehteh> much less interrupt load too
[09:03:06] <cehteh> theBear: no he needs an external dividder then (or none when his signal is slow enough)
[09:03:14] <theBear> mmmm, with the counting over a long time the accuracy/res. improves the longer period you pick for averaging over
[09:03:20] <theBear> so what IS a capture unit
[09:03:34] <cehteh> caputure unit captures the timer register in hardwares, issues an interrupt where you can process it
[09:03:49] <theBear> huh, you mean the timer overflow interrupt ?
[09:03:53] <cehteh> like a stopwatch button
[09:04:10] <cehteh> (well timer keeps running, the actual value is stored aside)
[09:04:23] <theBear> what, a hw overflow-counter ?
[09:04:44] <cehteh> not counter
[09:04:54] <cehteh> you know pinchange interrupt?
[09:05:32] <theBear> yeah
[09:06:01] <cehteh> now think you make within a pinchange interrupt capture = TCNT;
[09:06:34] <theBear> it's been too many years and i only just started actively programming again recently, remind me what TCNT means
[09:06:57] <cehteh> but that is inprecise because interrupts have a little delay (the running instruction will be finished first, then the interrupt handler is called (6 clocks), registers are safed, and finally you assing the current timer value to the capture)
[09:07:13] <theBear> or you mean like externally clocking the timer (treating it as a counter) maybe ?
[09:07:14] <cehteh> the capture unit does that in hardware
[09:07:46] <cehteh> saves the current timer value in a special register and then calls the interrupt
[09:07:52] <julius> LeoNerd, sure i can count to 100. but how to i get my ISR to overflow at a exact value?
[09:07:53] <cehteh> no
[09:08:02] <LeoNerd> julius: ??
[09:08:05] <cehteh> i saied its like a stopwatch button
[09:08:07] <theBear> so what does the capture unit do, or what is tcnt
[09:08:18] <theBear> what, it just stops the timer from counting ?
[09:08:49] <cehteh> julius: tip: better let your timer free running with TOP=MAX .. and use that as timebase
[09:08:51] <theBear> i just ain't getting what it sposed to do at all here
[09:08:51] <LeoNerd> julius: Your ISR gets called every e.g. 10msec. Inside there, you keep yourself a brand new counter, static uint16_t count = 0; increment that every call, and when it hits 10000 you know that's 1 second.
[09:09:18] <cehteh> theBear: not not stopping, but storing the timer value at the instant the event gets triggered
[09:10:06] <theBear> ahh, like a "lap" button on a stopwatch
[09:10:11] <theBear> that IS kinda cool
[09:10:11] <cehteh> exactly
[09:10:17] <cehteh> yes
[09:10:34] <theBear> you shoulda said the 2nd button <grin> woulda saved you lots of trying to explain to a slow guy
[09:10:41] <cehteh> so when he has a very fast signal he may prescale that externally .. like i saied /1024
[09:10:53] <LeoNerd> Ooooooh... New ATtiny chips announced. 102 / 104. /me reads about them
[09:11:09] <LeoNerd> ((hoping they have the tiny84/tiny85 compatible pinout and HVSP params)
[09:11:12] <cehteh> then he gets some reasonable slow/manageable signal .. and times each edge with the capture unit
[09:11:31] <cehteh> when thats not precise enough .. run the timer faster
[09:12:34] <theBear> mmm, i figure either approach the capture would help cos however you look at it, he gotta count/know when some real whole second(s) finish on a non-overflow (well, likely, they bound to line up eventually if you don't reset the timer every round) and accuracy is (among other stuff) completely dependant on that
[09:12:58] <cehteh> forget about the non-overflow .. just expect overflows :D
[09:13:15] <LeoNerd> Ooooh and a proper SPI port.. not USI
[09:13:44] <cehteh> and the point is, starting he timer when you start measureing has some latency
[09:13:50] <theBear> i expect them, but they not gonna line up with a whole second for WAY too long to do a single output calc, thus the capture will help a lot for finding that whole-second moment
[09:14:00] <julius> LeoNerd, ah ok. and then i just count the pulses from T0 in a different variable
[09:14:35] <cehteh> you really want to have the timer running already and then measure time between 2 values of this running timer
[09:15:24] <theBear> yeah, so you keep it zipping around, you got a overflow int that you only gotta count non-time-sensitively (within reason, it'll technically be fine to record/reset anytime before the next one) and the counter for your whole-second thing... hmm, tho i spose you don't need whole seconds/non-overflow-periods at all cos you got maths
[09:15:51] <theBear> oh wait, that doesn't help
[09:16:32] <theBear> the only reason the overflow int is non-time critical is cos the timer keeps counting while you handle it, whatever time you decide to use for your period per calc DOES need to be accurate
[09:17:14] <LeoNerd> julius: Yah. E.g. what I use in my software is a little array of timers that are "tickers" or "alarms" - the difference being repeat or oneshot. Each keeps its own count variable, and details for what to do when it fires. On the "main" system timer interrupt, I just walk that array, decrementing all the counters, and firing the task if the counter hits zero
[09:17:17] <theBear> spose it's still a interrupt, not too bad to have a conceptual if and one of two variables incremented in a handler methinks, should be TINY in asm
[09:17:39] <theBear> probly still be a few instructions less accurate than a capture to do that bit
[09:17:47] <LeoNerd> julius: Then I can have lots of things going on, limited just by the amonut of memory dedicated to that array
[09:17:50] <cehteh> and much more interrupt load
[09:18:31] <cehteh> like LeoNerd saied ... or here using priority queues instead arrays .. either works
[09:18:32] <theBear> you mean handler time ? cos you gotta have the overflow int running regardless to give you more than a single timer round of time
[09:19:27] <cehteh> just try to avoid to special purpose a single timer and *still* do it wrong :D
[09:19:31] <theBear> LeoNerd, mmm, that's how i used to handle "lots of" servos at once, only way that doesn't get way outta hand processing and time wise when you go past a very small number of servos/outputs
[09:19:59] <LeoNerd> Yup
[09:20:11] <LeoNerd> I find it really nice for any sort of interrupt-heavy async things
[09:20:15] <theBear> you know we're both agreeing on everything here, don't yer ?
[09:20:40] <LeoNerd> My interrupt handlers only do really little tasks, mostly just scheduling tasks to run. The main loop then just iterates over runnable tasks and then sleeps on interrupts
[09:20:52] <LeoNerd> It's handy for doing things like atomic access to I²C or SPI devices
[09:21:02] <theBear> as anyones interrup handlers should, that's just one of the rules, like not leaving logic (specially cmos) inputs floating, ever
[09:21:23] <theBear> or not sticking both hands inside live hv equipment at the same time
[09:21:32] <theBear> "the rules"
[09:22:01] <LeoNerd> This makes my tickers/alarms easy too.. each one just activates a task.. so the main timer interrupt handler doesn't run any real code
[09:22:31] <theBear> pfft, i should probly take my wet washing up to the latenight laundromat before it goes smelly for a nice spindry, save having it hanging all over the house and still drying slow
[09:22:59] <theBear> yeah, (not running any real code inside ints) that's the same rule :)
[09:23:05] <cehteh> other way: int32_t counter; ISR(pinchange){++counter;}; ISR(OCRA) { enable_pinchange_intrrupt(); }; ISR(OCRB) {disable_pinchange_interrupt(); store counter aside}; main() { TCNT=0; ORCA= 0 + 1ms; OCRB = ORCA+1sec; enable_OCR_interrupts(); start_timer(); ....
[09:23:38] <LeoNerd> I do have a couple of exceptions.. e.g my LED matrix driver is entirely done inside the timer interrupt, as all it does is fiddles the dedicated GPIO pins
[09:23:43] <cehteh> mhm julius passed out 15 minutes ago already :D
[09:23:55] <theBear> keep em down to the bare essentials to achieve their function/purpose, so that the others can do the same when they need to, "everything else" ends up being anything non time-critical, and off yer go
[09:24:11] <LeoNerd> Ohyes, well PWM'ed LEDs are timing critical :)
[09:24:24] * LeoNerd has PWM-capable charliplexing
[09:24:32] <theBear> mmm, thats another of the rules... once you know and understand and follow a rule for long enough, you become qualified to know when it may be broken:)
[09:24:42] <theBear> oooh, pwm charlie, fancy
[09:24:54] <theBear> plus it sounds like a cowboy/oldentimes outlaw
[09:24:57] <LeoNerd> One of my favourite sayings in that direction: Rules are for the guidance of wise men and the obedience of fools
[09:26:32] <theBear> heh, i like it
[09:27:15] <theBear> covers my feelings about western/christian religions nicely too, tho in potentially offensive wording if the "fools" understood it
[09:27:25] <theBear> :)
[09:51:13] <julius> no no, im here
[09:51:22] <julius> just got my lunch
[09:52:04] <julius> half an hour, than my avr gets counting
[10:52:10] <Lambda_Aurigae> then
[10:53:31] <Lambda_Aurigae> theBear, I like that saying. Might get a t-shirt made with it!
[11:29:18] <theBear> what, you mean leo's saying i thinks
[12:44:19] <julius> ive got a int in my ISR that is set to 1 about every second (led blinking says the timing is right), but somehow when i check if (check_freq == 1) { in my main, the code never enters the if condition
[12:45:10] <Caesium> might need to be set volatile?
[12:48:32] <antto> julius "int" ?
[12:48:49] <antto> that would probably end up as int16_t
[12:49:55] <julius> uh , yes
[12:49:59] <julius> let me check that
[12:53:34] <julius> i changed it to "unsigned int check_freq = 0"; gets set to check_freq = 1 in the ISR and in main it is checkd with: if (check_freq == 1) {
[12:53:37] <julius> is that wrong?
[12:56:29] <LeoNerd> If you're sharing a variable between ISR and non- code, you want to declare it volatile
[12:56:43] <LeoNerd> Also you might want to do an atomic read on it, since it's a 16bit value
[13:00:53] <julius> what does volatile do?
[13:02:36] <learath> volatile means it can be modified at any time
[13:06:24] <aandrew> julius: basically it instructs the compiler that it cannot optimize accesses to the variable
[13:06:40] <julius> well, it works
[13:06:41] <aandrew> compilers will often put a variable in a register and use it from the register
[13:07:00] <aandrew> which means if something else is writing to the actual memory location, the code doesn't "see" it because it's executing out of the register
[13:07:18] <aandrew> 'volatile' tells the compiler it can't make this kind of optimization with this particular variable
[13:10:25] <julius> well, that probably threw me back day, fuck
[13:12:07] <learath> aandrew: that's a way better explanation.
[13:14:26] <julius> thank you very much
[13:14:29] <julius> that almost got to me
[13:15:33] <aandrew> julius: it's a very, very easy mistake to make when starting out
[13:15:39] <aandrew> everyone and I mean everyone hits it
[13:18:15] <julius> im gonna go get some air, cu
[13:48:50] <jacekowski> actually, volatile in this case probably prevents compiler from optimising that if completly
[13:49:25] <jacekowski> avr-gcc would in this case completly get rid of the if because there is nothing changing the variable in the same function
[14:03:10] <julius> its like getting divorced, the women takes everything
[14:10:03] <julius> i just realized that my bluetooth module is only using RX/TX/VCC/GND so i could exchange it for a serial -> usb converter without code change
[14:21:27] <cehteh> anyone of you implemented XON/XOFF for the atmega UART? i wonder if its worth it or if tx buffers on the PC side nowadays are too big already
[14:33:54] <antto> i've only gone as far as using synchronous uart between two xmegas where one of them acts as a tcp socket pipe
[14:35:52] <antto> Dean :twisted:
[14:35:55] <antto> huehue
[14:36:42] <abcminiuser> Heh
[14:36:52] * abcminiuser gets ready for work
[14:36:59] <abcminiuser> I need to find an IRC client for my phone...
[14:37:02] <HaibaneNero> i got an arduino last weekend because i wanted to have an atmega328p for coding again. I found out that the arduino uses a bootloader that allows me to program over USB, without extra ISP
[14:37:23] <antto> fancy schmancy
[14:37:23] <HaibaneNero> does the arduino bootloader protect itself from overwriting it?
[14:37:56] <antto> it's meant for kids, so it should be kid-proof
[14:38:14] <HaibaneNero> but kids will use the Arduino IDE, which does some magic i dont understand
[14:38:26] <antto> unless it was flashed (specifically the lock bits) by a.. kid
[14:38:41] <antto> neither do i
[14:39:01] <HaibaneNero> i got the right parameters for avrdude by stracing the arduino IDE..
[14:40:07] <HaibaneNero> am i safe to assume that the people here dislike certain arduino things?
[14:41:12] <Caesium> "the people"? :)
[14:41:17] <Caesium> we have individual minds :)
[14:41:33] <Caesium> we are not the borg ;P
[14:42:09] <HaibaneNero> whatev
[14:44:10] <Caesium> I think the Arduino IDE is fucking terrible. calling it an IDE is a dis-service to real IDEs
[14:44:30] <Caesium> the concept of taking an avr and putting it in easy to use dev boards and selling it to kids is fantastic though
[14:44:41] <antto> some call them Lolduinos
[14:44:56] <antto> probably the same people who also say Lolbuntu
[15:05:27] <Jartza> ih, it's called ide?
[15:06:17] <Jartza> I thought it was lousy editor with build-button to launch some horrid java code to build and flash something
[15:19:23] <WormFood> How do you guys say "UBRR"? Do you try to pronounce it, like a word? Maybe like "uberrrr". Or do you sound out the letters, like you-bee-arr-arr?
[15:20:09] <WormFood> I personally sound out the letters, trying my best to sound like a pirate.
[15:22:07] <WormFood> A pirate walks into a bar, and the bartender says "Hey! There's a ship's steering wheel in your pants!", and the pirate says "Arrrr, it's driving me nuts."
[15:22:28] <twnqx> you be arr-arr? talking with your kid? :P
[15:22:53] <twnqx> but yes, i do spell out the letters, too
[15:23:59] <WormFood> so, when typing it, is it "a UBRR register", or "an UBRR register"? (don't let the first letter being a "U" fool you. The a/an rule isn't about the spelling, it's about the sound)
[15:24:18] <twnqx> i'm using a
[15:24:20] <HaibaneNero> just say UBRR like its a name
[15:24:29] <HaibaneNero> "write 0 into UBRR"
[15:24:31] <julius> resistance is futile, youre arduoino will assimilated
[15:24:37] <WormFood> HaibaneNero, how does that sound?
[15:24:42] <julius> be
[15:24:57] <Caesium> there's only one, so its "the UBRR register" to me
[15:25:05] <HaibaneNero> im german, so probably like "Uhh-brrr"
[15:25:22] <WormFood> uh, what about "UBRR value"?
[15:25:58] <HaibaneNero> hm?
[15:26:05] <WormFood> I suppose you could also use "the" there.
[15:26:35] <HaibaneNero> "Der Wert von UBRR" - this seems to be easier in german
[15:26:36] <julius> in germany you could say "das mistige über register"
[15:26:51] <WormFood> depending on the surrounding words. Using "the" instead of a/an sounds very...Chinglish (I live in China, so I hear that a lot)
[15:27:27] <HaibaneNero> You also dont say "a WormFood" or "the WormFood"
[15:27:31] <WormFood> I would use "a UBRR value"
[15:27:38] <WormFood> HaibaneNero, neither.
[15:28:03] <julius> but ubbr is nothing compared to "volatile" - that thing costs me some hours today. trying to check a var thats changed in a ISR inside the main
[15:28:09] <WormFood> It's a proper name, in this context. Replace "WormFood" with "Joe" or "Fred", and see how it sounds.
[15:28:22] <WormFood> julius, use asm ;)
[15:29:00] <WormFood> Asm is awesome. I do stuff in asm, I couldn't imagine doing in C.
[15:29:12] <HaibaneNero> whatever, i managed to program that thingie twice via the bootloader, so antto was right
[15:29:45] <WormFood> Right? About what?
[15:29:50] <julius> WormFood, there are uses for it, but i dont have a spare brain lying around that i could use after destroying my current one while learning asm
[15:30:02] <HaibaneNero> > (20:12:54) antto: it's meant for kids, so it should be kid-proof
[15:30:23] <julius> HaibaneNero, so you basically use it like a normal avr?
[15:30:39] <HaibaneNero> except that i use the arduino bootloader
[15:30:51] <julius> and how do you combine that with avrdude?
[15:31:14] <WormFood> ah. Yes. You can't do it, because it's too hard to learn. A lot of people think reading Chinese is the same way, but once you learn the rules, it's surprisingly simple (I'm not saying it's not hard, I'm saying it has a perception of being much, much harder than it really is). Asm is the same way.
[15:31:46] <HaibaneNero> i started the arduino "IDE" with strace and looked for execve calls, and i found some line that worked
[15:32:27] <julius> sure, but im really more interrested in easy to use languages like python/java/c
[15:32:45] <WormFood> I didn't do anything with asm for about 15 years. I'd occasionally disassemble something to understand it, but didn't write anything. When I wanted to write something that needed asm, I just jumped in, and started doing it like a pro. I surprised the hell out of people.
[15:32:52] <julius> i mean, how do you tell avrdude not to kill the bootloader part?
[15:33:01] <HaibaneNero> julius: i don't
[15:33:05] <WormFood> java?
[15:33:21] <WormFood> why would you want to invest time to learn java?
[15:33:34] <HaibaneNero> but the bootloader is starting at 0x7800, and thats pretty much at the end
[15:33:48] <julius> WormFood, to be honest i cant imagine coding that all day long
[15:34:02] <HaibaneNero> julius: i omitted the -D option for avrdude, to prevent it from clearing the flash
[15:34:03] <julius> HaibaneNero, ah, so you flash code thats smaller and thats it?
[15:34:06] <WormFood> julius, It's not that hard. Really.
[15:34:07] <HaibaneNero> i forgot that
[15:34:18] <HaibaneNero> julius: thats the only explanation i have
[15:34:29] <julius> WormFood, forgot to add java in that sentence. wasnt talking about asm
[15:34:32] <WormFood> I'm not suggesting writing big things with it, but sometimes it's really the best way to go.
[15:34:39] <julius> HaibaneNero, good to know, thanks
[15:35:03] <julius> sure if you like it, why not
[15:35:06] <HaibaneNero> i barely had contact with avr stuff until now, so i'm not sure about things and stuff
[15:35:28] <WormFood> I didn't do much with avr asm, but I did a little bit. I wrote one program, that'd glitch about once every 3 days, and was never able to track down the bug, before I came to China. Oh well.
[15:35:29] <julius> heard good things about arduino
[15:36:23] <WormFood> A lot of people seem to be confused, about what exactly an "Arduino" is.
[15:36:58] <WormFood> Many seem to think, you have to use the Arduino sdk/libraries to use it.
[15:36:58] <julius> got some tested pwm code here. my mini example just initializes OCR1B = 60 to get some duty cycle and the motor starts running immediately. can i just set the duty cycle to 0 and change it latet?
[15:37:29] <WormFood> not if you expect it to run
[15:37:45] <julius> or do i have todo the complete initialization every time?
[15:38:20] <julius> i mean, setting TCCR1a, TCCR1b, ocr1a ?
[15:38:44] <HaibaneNero> WormFood: my guess: an Arduno is just the hardware around the avr uc? and the bootloader?
[15:38:55] <HaibaneNero> *arduino
[15:39:15] <HaibaneNero> but i also heard that there were arduino's based on ARM or other weird stuff
[15:40:17] <julius> arduino was a genial idea to make money out of avr
[15:40:29] <WormFood> http://wormfood.net/avrbaudcalc-testing.php I'm working on the css. I'm shit at css. I have one more bug to fix.
[15:40:36] <julius> just make it a bit more user friendly and keep cashing in with addons
[15:41:20] <julius> WormFood, may i suggest something?
[15:41:30] <WormFood> HaibaneNero, you're mostly right. It's the bootloader. But also the SDK, with "easy to use" libraries, and a standard for the hardware
[15:41:36] <twnqx> well, the hw design i saw (one, the leonardo) is abysmal at best
[15:41:46] <WormFood> of course julius, I welcome all suggestions, comments, positive or negative.
[15:42:05] <julius> WormFood, Data bits+parity in that dropdown menu, remove the 8-, 7- and so on. its a duplication in my opinion of the next part
[15:42:11] <julius> like 8-8 data bits...
[15:42:30] <julius> or what is the first number good for?
[15:42:49] <WormFood> That number is for the number of data bits, and the parity bit
[15:43:14] <WormFood> so, 7 data bits, plus parity, is the same as 8 data bits, without parity.
[15:43:36] <WormFood> It's just that 2 different combinations come out to be the same value.
[15:43:45] <WormFood> I could split it up, as databits, and a parity check box.
[15:43:52] <julius> ah
[15:45:54] <WormFood> so, what's your suggestion knowing that information? You didn't understand it, so I feel like I didn't do a good job explaining what is going on. I do have mouse-over notes, did you notice that (and would that help you to understand it better?)
[15:46:26] <WormFood> I don't want people to see that, and say "WTF?!?", like I imagine you did.
[15:46:59] <WormFood> actually, if you turn off color, that setting has no effect.
[15:50:50] <julius> the information is good
[15:51:07] <julius> it just looks like the first number and the - is just a number to order things
[15:51:09] <WormFood> if I knew javascript, I'd make the dropdown inoperative, if the hide color checkbox is checked.
[15:51:15] <julius> which could be dont in the background
[15:51:53] <julius> WormFood, theres #javascript....ive only dont the hello world
[15:52:21] <julius> s/dont/done/
[15:53:16] <WormFood> I'm not interested in learning js, at this time.
[15:53:28] <WormFood> I'm sure I can pick up the syntax easy enough tho.
[15:53:44] <WormFood> But, I have to learn the environment.
[15:53:56] <WormFood> Anyways, I need to go to bed. It's after 5 am here.
[15:53:56] <julius> yeah, webdevelopment...
[15:54:06] <julius> sooner or later you gonna stumble about css/js
[15:54:11] <julius> ah, gn8
[15:54:23] <WormFood> And, I think I'll change that dropdown, to a data bit selection, and a parity checkbox.
[15:55:06] <HaibaneNero> uhm, WormFood, maybe you'll like twitter bootstrap, it provides some cool css classed to make stuff fancier
[15:55:26] <WormFood> If any of you guys know JS, and want to help out with that, just send me a /msg. I'm sure it's trivial, I just don't know how to do it....but I bet I could do it in 10 minutes with google.
[15:55:30] <HaibaneNero> its quite big tho, but you can just pull the stuff you like
[15:56:02] <WormFood> I was thinking about some of that stuff. There are some of those things that are nice, but don't know their names 'n such
[15:57:23] <WormFood> HaibaneNero, if you have a proposal, just take the html from my calculator, and do whatever, and if I like it, I can incorporate it into the page. (I can even give you credit, if you'd like)
[15:58:51] <WormFood> I'm not a total css idiot, but I'm pretty noobish. I know a few "advanced" tricks, here and there, but only to do some things, but lack a lot of the basics. It's hard shit to remember, how everything interacts. That hurts my brain much more than asm
[15:59:01] <WormFood> Anyways, I gotta go. Chat later. 再见
[16:06:16] <julius> probably bed time for anyone besides the germans here?
[16:09:31] <HaibaneNero> anywhere east of germany
[16:09:41] <HaibaneNero> for approx. a quarter globe
[16:10:35] <julius> so where are you from in germany?
[16:11:03] <twnqx> normally my bedtime is around 2am...
[16:11:13] <twnqx> not 10:30 :P
[16:11:21] <HaibaneNero> julius: DDR Verwaltungsbezirk Gera
[16:12:00] <twnqx> neufünfland
[16:13:19] <julius> im from the south of "niedersachsen"
[16:13:24] <julius> not that far away
[16:13:46] <twnqx> kassel? göttingen? :P
[16:13:46] <HaibaneNero> im actually not that interested in physical meetups
[16:13:50] <julius> do we need to speak english when everybody is asleep?
[16:13:55] <HaibaneNero> yeah
[16:13:57] <julius> just asking
[16:14:03] <HaibaneNero> because freenode is an english network
[16:14:06] <julius> near kassel
[16:14:06] <twnqx> people could want ot read backlog
[16:14:29] <twnqx> currently berlin
[16:14:33] <HaibaneNero> also, english is easier to write for me
[16:14:37] <twnqx> thursday hamburg
[16:14:51] <twnqx> let's see where i'll be friday ;D
[16:15:35] <julius> what do you do for a living if i may ask twnqx?
[16:15:52] <twnqx> "Senior IT Security Consultant"
[16:16:15] <julius> and what went trough your head when you read about the adobe security breach?
[16:16:24] <twnqx> not much
[16:16:29] <twnqx> business as usual
[16:16:35] <HaibaneNero> im Studying in the Dual System
[16:16:45] <HaibaneNero> Some Sort of IT
[16:16:58] <julius> yes it happens
[16:17:24] <twnqx> people who think they can protect against security breaches are wrong.
[16:17:53] <twnqx> you may be able to protect yourself as an educated user, using massive hardening
[16:17:58] <twnqx> but that's about it
[16:18:14] <HaibaneNero> i would describe it as "making intrusion just more difficult"
[16:18:25] <julius> true, i do believe trough the complexity that it will happen again and again
[16:18:43] <HaibaneNero> twnqx: can you link the specific adobe breach?
[16:18:57] <twnqx> well, truely targeted intrusion on the level of NSA/GCHQ, yes, "just more difficult"
[16:19:11] <twnqx> the usual baord waves are simple enough to evade just by not using windows :P
[16:19:23] <julius> hehe
[16:19:27] <twnqx> broad*
[16:19:56] <twnqx> dunno how my locky emails i clicked on, having libre office tell me they turned off macro support :P
[16:20:12] <twnqx> (it was on purpose, of course)
[16:20:28] <HaibaneNero> hm. i don't even use *office anymore
[16:20:44] <HaibaneNero> the last presentation i did was just an html page, some css and java script
[16:20:51] <julius> if i would be more interrested in security i would turn it on too
[16:21:10] <twnqx> HaibaneNero: can always use that presentation tex version :P
[16:21:34] <twnqx> also, re: adobe breach, i think he was referring to the 2013 one :P
[16:21:39] <HaibaneNero> i dislike LaTeX enough to have an self-written tool to generate my thesis-like papers from markdown
[16:22:11] <twnqx> i wrote my thesis in tex
[16:22:14] <twnqx> painful
[16:22:22] <julius> thats just stupid HaibaneNero
[16:22:22] <twnqx> butless painful than office, still
[16:22:28] <julius> yes
[16:22:36] <julius> tex makes sense
[16:22:42] <twnqx> but other than that... i just use office
[16:22:51] <twnqx> that's what throwaway VMs are for
[16:23:04] <julius> 2013, has it been that long?
[16:23:46] <julius> oh yes it has been
[16:23:47] <twnqx> but what's the difference to playstation network
[16:24:00] <twnqx> or the millions of stolen credit cards every year
[16:24:28] <twnqx> and then i get paid by vendors to do security analysis of their products
[16:24:33] <twnqx> and then they just ignore the result
[16:24:36] <twnqx> and i get my money
[16:24:45] <julius> im not that close to the security news, adobe was the first thing that popped into my mind
[16:24:56] <HaibaneNero> i think the time has come that people should realize that they shouldn't give their credit card information to companies
[16:24:59] <julius> thats custormers
[16:25:16] <twnqx> just the recent news
[16:25:28] <twnqx> a fraunhofer institue locked down by locky
[16:25:35] <twnqx> several hospitals locked down, lol
[16:25:57] <twnqx> bundestag intruded by (maybe) russian hackers (last year)
[16:26:12] <twnqx> i mean, the problem is not protecting servers
[16:26:17] <twnqx> the problem are users.
[16:26:37] <julius> i can agree with that, from what ive seen other people do
[16:27:04] <julius> adding scripts to their browser to manually accept every cocky, but still downloading warez from any source they can
[16:28:11] <julius> ltoa(freq,buffer,10); converting the unsigned long "freq" with that c function shows me 380.000 via bluetooth. but when i check in the code with: if (freq <= 20000) it is true. how can that be?
[16:29:02] <HaibaneNero> overflow?
[16:30:06] <twnqx> is freq int or long?
[16:30:23] <HaibaneNero> unsigned long, he said
[16:30:56] <twnqx> did you try with 20000ul? :P
[16:31:55] <HaibaneNero> oh god i've read of such a case in the "Linux on Atmel"-Article
[16:33:47] <HaibaneNero> im pretty amazed that i managed to flash my arduino without problems
[16:34:00] <julius> unsigned long, i added UL. now the pump does not start at all...something changed at least
[16:34:15] <HaibaneNero> what are you programming?
[16:34:31] <julius> moist sensor for a water pump, plant watering
[16:34:41] <x29a> julius: are you using uint32_t and such types?
[16:36:17] <julius> ah yes, a second if was wrong
[16:36:51] <julius> i copied the frequency calculation from someone else, have to look into it
[16:36:59] <julius> if it fits
[16:37:08] <julius> but sure, why not
[16:37:36] <julius> twnqx, thats actually a good question. what does a security person do with avr?
[16:38:05] <twnqx> having hobbies, mainly
[16:38:26] <twnqx> i also do device security testing AKA penetration testing
[16:38:44] <twnqx> actually, i found several AVRs just today in the machine i am currently looking in :D
[16:38:49] <julius> nice
[16:39:51] <twnqx> http://i.imgur.com/FoCn6ks.jpg driving concepts of infinity mirrors :P
[16:41:03] <twnqx> http://i.imgur.com/Db4nqCP.jpg overcoming stupid watchdogs while hacking devices
[16:41:26] <julius> looks nice
[16:41:54] <twnqx> http://i.imgur.com/BGqhvCK.jpg CAN bus dumpers, including direction information
[16:42:09] <twnqx> well, lots of things actually. neat little cheap chips
[16:42:22] <julius> isnt can used in cars?
[16:42:26] <twnqx> yes.
[16:42:43] <twnqx> and the second image is an engine controller from a car :P
[16:43:14] <julius> so not long before theres enough technology to hack in a car
[16:43:30] <twnqx> uh
[16:43:38] <twnqx> i actually wanted to setup a blog
[16:43:53] <twnqx> JUST for not losing track of all the shit that happens to car electronics
[16:43:58] <twnqx> last year was pretty horrible
[16:44:30] <twnqx> bmw: let's unlock doors by sending an SMS. with a portable fake base station.
[16:44:32] <julius> it was?
[16:45:03] <julius> oh, yeah. thats not so good
[16:45:21] <twnqx> chrysler or GM or something: let's remote control brakes and stuff by breaking into the multimedia system, reprogramming the security gateway from there, and then manipulating whatever
[16:45:27] <twnqx> tesla: similar
[16:45:35] <julius> didnt they used to block the 433mhz range when a owner wanted to close his car via his handkey
[16:45:58] <julius> yes, the automated brakes..quite useful. if its works
[16:46:01] <twnqx> all cars with keyless entries: prices for rane extender kits dropped to sub-1000€
[16:46:13] <twnqx> now the car thinks you hold the key in front of it, while you're 400m away
[16:46:21] <twnqx> range extender*
[16:46:33] <twnqx> and that's just OTOH, not everything
[16:46:46] <julius> youre clearly more up to date than me
[16:59:35] <Jartza> oh well
[17:44:03] <julius> are you a expert on phase and freq correct pwm?
[18:31:41] <theBear> fuck yes
[18:32:05] <theBear> oh, well, you mean phase, AND or phase correct pwm ?
[20:39:53] <Guest30163> I have a C++ question for anyone who may be around
[20:41:13] <QaZShaft> An avr related C++ question really
[22:11:23] <Tom_itx> guess he was too shy to ask
[22:22:29] <phinxy> Can an avr micro freeze / reboot because of a burst of RF?
[22:26:23] <Casper> sure
[22:26:42] <Casper> specially if the circuit is badly constructed
[22:27:06] <Casper> like missing decoupling caps and missing pullup or too weak one on reset
[23:14:15] <phinxy> Ok. Can this be harmful in the long run?
[23:15:32] <phinxy> I am 90% certain its RF interference. Its coming from a HID ballast when it starts. They are knows to interfere with radio's and such.
[23:16:24] <Casper> is the avr on a breadboard?
[23:16:51] <phinxy> Its.. badly designed. It's "floating" in the air in a blob of hot melt
[23:18:05] <Casper> so no decoupling capacitor and no apropriate pullup on reset then ?
[23:18:09] <phinxy> the reason i think its RF is because often it does not reboot or freeze but the hall sensor goes whack and the tachometer says the bike is going 255 km/h
[23:18:17] <phinxy> there are decoupling caps
[23:18:25] <phinxy> on Vcc and Vref side
[23:18:50] <phinxy> I never heard of putting a pullup on the reset
[23:19:45] <phinxy> that hall sensor bug is happening when you start the HID bulb. If the light is already on everything is fine.
[23:20:48] <Casper> a proper circuit will have reset pulled high by a <=10k resistor or hard wired to vcc. There is an internal pullup, but quite weak (can be over 50k) and very sensitive (reset happend I beleive at VCC-0.3V)
[23:21:33] <Casper> as for the hall bug, maybe there is too much noise picked up by the wiring due to a too high pullup?
[23:21:51] <phinxy> 1.2K
[23:22:02] <phinxy> its in the low end
[23:22:46] <phinxy> When the MCU locked up the display did draw random pixels on the screen
[23:23:50] <Casper> also, are you sure that the supply don't drop when it start?
[23:23:55] <phinxy> The MCU runs for 3-4 seconds with the battery disconnected
[23:23:58] <phinxy> and i have a diode
[23:24:05] <Casper> sometime those take lots of current
[23:24:10] <phinxy> DIODE > 6800uF > REGULATOR > MCU
[23:24:50] <phinxy> If i ran the start motor on the motorcycle the MCU would reboot but after i added the cap and diode its fine
[23:25:15] <phinxy> Maybe it could be high voltage spikes
[23:25:20] <phinxy> that gets trough from the ballast
[23:26:31] <Casper> do you have any capacitor after the regulator?
[23:26:43] <phinxy> No
[23:27:08] <Casper> what kind of regulator? 7805?
[23:27:44] <phinxy> Its a 12-24 -> USB 5V regulator for cars
[23:28:01] <Casper> ok, so a module
[23:28:22] <Casper> and of course you have no oscope
[23:28:28] <phinxy> :)
[23:28:52] <phinxy> If we assume its RF
[23:28:56] <phinxy> Can you shield the MCU
[23:29:38] <phinxy> now that i think of it, the MCu is only a couple centimeters from the bulb that arcs
[23:30:10] <phinxy> 3 centimeters
[23:32:02] <phinxy> i believe ive read somewhere that a spark will generate RF
[23:32:20] <Casper> put grounded metal foil around it
[23:32:36] <Casper> if it is RF related, it should block it up
[23:33:54] <phinxy> Could a piece of thin copper-paper work?
[23:34:14] <phinxy> sheet metal
[23:34:28] <Casper> sure
[23:34:32] <Casper> copper would be ideal
[23:38:15] <Tom_itx> lead
[23:40:15] <Casper> Tom_itx: you mean just use flint water around it?
[23:40:50] <phinxy> lead is for radiation
[23:41:04] <Tom_itx> or if you need a snack