#avr | Logs for 2012-06-27

Back
[05:48:02] <electronics-cat> good afternoon
[05:48:40] <electronics-cat> im looking for GuShH_
[05:50:51] <specing> GuShH_ is here
[08:08:25] <rhumbot> hi all. i have a stupid question: first time i use transistors ... https://dl.dropbox.com/u/44108612/3.PNG where is the mistake?
[08:09:01] <rhumbot> i know this is probably not the right channel but i dont know where to ask
[08:09:05] <amee2k> the transistor is on the high side
[08:09:49] <amee2k> what you made there is an emitter follower. the voltage across the voltmeter won't get higher than the input voltage minus about half a volt or so
[08:10:52] <rhumbot> ok. i understand at least a little bit :) how else do i transform the signal or a uC to 12V?
[08:11:43] <amee2k> a bipolar transistor like that one behaves roughly like there is a diode between base and emitter, and the collector current is some gain figure times the base current. all currents exit through the emitter
[08:13:31] <rhumbot> i think i get what you mean. when i place the voltmeter between the transistor and the aource i get the 12v and can still switch it using the uC
[08:13:32] <amee2k> if you use it like that, the emitter voltage is always going to be a bit below the base voltage because of the diode-like effect. if the voltage were to rise any higher, no base current would flow anymore because the base-emitter junction is reverse biased
[08:14:07] <amee2k> the usual configuration is to put the emitter to ground and put the load between collector and +12V
[08:14:49] <rhumbot> thank you! i think i just got an important point!
[08:15:10] <amee2k> as a side note, a 337 is a relatively small transistor with high gain. typically something much greater than 100
[08:16:06] <amee2k> your 750R base resistor would pass a pase current of something like just over 5mA. that means the maximum possible collector current is probably around an amp or so
[08:16:11] <rhumbot> which one would you suggest? i need about 350 mA for the 12V devices
[08:17:33] <amee2k> 1k should be guaranteed to work too. my fairchild datasheet says minimum gain is 60 at 300mA
[08:17:55] <specing_> rhumbot: use a darlington
[08:18:15] <specing_> ULN2003, for example
[08:18:17] <amee2k> MOSFET?
[08:18:30] <specing_> or a mosfet
[08:19:20] <amee2k> if you can find the 337-25 variant, minimum gain is 160 so a 1.8k or 2.2k is going to work too
[08:19:45] <amee2k> i tend to use MOSFETs for things >>100mA though
[08:19:53] <rhumbot> i will look into mosfet transistors. i am not familiar with them ...
[08:21:17] <amee2k> mosfet is like... gate-source voltage controls drain-source current. the advantage compared to a BJT is that the gate is high impedance and voltage sensitive instead of current sensitive
[08:21:31] <amee2k> so you can switch a lot of current with virtually no drive power
[08:22:11] <CapnKernel> MOSFETs ftw
[08:22:41] <CapnKernel> p-channel are a little harder to use than n-channel though.
[08:22:50] <amee2k> not entirely, but it does seem that they have the high power switching market cornered for themselves
[08:23:07] <amee2k> maybe with the exception of IGBTs, but still
[08:23:56] <amee2k> i find MOSFETs refreshing because they eliminate the need for base resistors, and if speed isn't critical you can easily use higher resistor values in general
[08:56:11] <inflex> amee2k: well, you still are 'well advised' to have gate resistors and gate-source resistors
[08:56:30] <inflex> amee2k: but yes, in terms of the actual operation of the device, MOSFETs are a whole lot nicer than BJTs
[08:57:56] <amee2k> pull resistors on signal lines that leave the board are a good idea in case the pin ever goes floating while the circuit is powered
[08:58:16] <amee2k> unless high speed switching is involved, i'm not sure why i'd want gate resistors though
[08:58:39] <amee2k> well, or there is some expensive IC driving the gate that i want to protect in case the transistor fails
[08:59:01] <amee2k> transistors have an annoying habit of failing three-way short >_<
[09:04:31] <amee2k> only thing that i don't like is that most of the "old school" MOSFET types don't work very well for supply voltages less than 5V
[09:05:36] <inflex> good thing if you're designing the circuit that you can use new-school ones :)
[09:06:39] <amee2k> meh. i like my good old BS170/700x
[09:06:43] <inflex> the use of a gate-resistor is to avoid having your poor uC hammered by the gate-capacitance; of course, it depends on the MOSFET size, anything up to ~10nC total charge is likely fine on AVRs, but when you start seeing 20nC+ it'd be nice if you limit it with a 150R resistor or so to keep the peak current to no more than 40mA
[09:07:03] <inflex> I don't see any reason to stick with old MOSFETs when new ones have better characteristics all around
[09:07:16] <inflex> lower total-gate-charge, lower RdsON, etc etc
[09:07:41] <amee2k> finding good new shit at decent prices and in usable packages stinks
[09:07:52] <inflex> there is only one old-school MOSFET I use and that's the 2N7002, because it has such a woeful Rds that it means I can leave out the current-limit resistor on the LED it switches on :)
[09:08:09] <inflex> Are you doing pin-through/TO220 or SMD?
[09:08:09] <amee2k> heh
[09:08:18] <amee2k> pth mostly
[09:08:45] <amee2k> SMD isn't really worth it for one-offs. long turnaround and expensive messing with boards
[09:09:09] <inflex> because I just LOVE searching and finding awesome new ones in SMD, SOT23s down to 0.016R ... and the lovely SOT667's down to 0.0009R (like a SO8 but flatter and a large source)
[09:09:27] <inflex> that's interesting, because I find pth to be more costly for what I do
[09:09:36] <inflex> (and more annoying to prototype)
[09:09:41] <inflex> but I suppose it depends on what you're doing
[09:10:07] <amee2k> the printer i have sucks for toner transfer and i don't like buying a second one just for making boards
[09:10:27] <amee2k> and drawing SOT/SOIC by hand stinks
[09:10:37] <inflex> ah okay, I just make up my protoboards in Eagle and send them off to seeedstudios or similar... 2 weeks later, I have my project ready to go.
[09:11:22] <amee2k> no credit card on my end ;)
[09:11:49] <inflex> PayPal? what about those VISA debit voucher cards
[09:11:51] <amee2k> and after two weeks of sitting on my ass i'd probably have forgotten about the project anyway :P
[09:12:32] <amee2k> i tried a PP account backed by a real bank account, but i had problems with PP requiring me to add a CC on check-out twice before
[09:12:54] <amee2k> and it doesn't accept the EC/Maestro debit card in that case. only popular credit brands
[09:13:15] <amee2k> i had to cancel an order because of that shit
[09:20:50] <amee2k> tobboritis
[09:22:10] <GuShH> amee2k: look whos talking, you've got orangeitis.
[09:22:25] <amee2k> and you've got frogitis. so what?
[09:22:31] <GuShH> I don't
[09:23:00] <amee2k> yes you do
[09:23:29] <GuShH> nope
[09:23:38] <GuShH> I don't see myself hiding like a roach
[09:23:55] <amee2k> :P
[09:24:11] <amee2k> http://www.zen22142.zen.co.uk/Circuits/Testgear/connectiontester.gif << you got thoughts on that one?
[09:25:01] <GuShH> for continuity?
[09:25:48] <amee2k> yep
[09:26:10] <GuShH> thoughts... why bother with today's meters
[09:26:33] <amee2k> because i need a simple, self-contained continuity tester to integrate into another project
[09:26:44] <GuShH> otherwise, sure it works such as a constant current source and an adc would.
[09:27:45] <amee2k> that resistor network is tough to analyse, but if the opamp has low offset voltage drift, it looks i can easily calibrate the trip point to within one or two ohms
[09:28:11] <GuShH> you can because you use a test resistor to "calibrate"
[09:28:16] <GuShH> of whatever value you want
[09:28:28] <GuShH> -within its operating range-
[09:30:14] <amee2k> the usual ghetto continuity tester with a single BJT doesn't have an easily controllable trip point
[09:30:42] <amee2k> and if you want low test current, then the trip point is usually at relatively high resistance
[09:31:10] <GuShH> fuck youtube!
[09:31:38] <amee2k> we love you too, you know
[09:32:13] <GuShH> it should ask you whether you want to leave the page or not while it's loading a video and you accidentally click one of the suggested bullshit on the right (mis-click from the scrollbar)
[09:32:48] <amee2k> ewwies.
[09:36:36] <GuShH> amee2k: that's one ghetto site
[09:36:36] <rhumbot> so if i use mosfet transistors and build the circuits like https://dl.dropbox.com/u/44108612/5.PNG - it will work without any restors? i need 12V and approximatley 350mA where the voltmeter is positioned ...
[09:37:33] <amee2k> GuShH: what, youtube? no poop right there :P
[09:37:43] <GuShH> amee2k: the continuity page
[09:37:55] <amee2k> oh. i never looked at the page, just that pic
[09:38:02] <amee2k> found it via google image search :P
[09:38:11] <GuShH> along with 100 pics of titties
[09:38:32] <amee2k> rhumbot: that should work. check the datasheet for that transistor to see if you have enough gate voltage
[09:38:52] <rhumbot> enough voltage to switch?
[09:39:07] <amee2k> the datasheets specify on-resistance for different gate-source voltages. pick the next lower Vgs value that is specified and see if it works out
[09:40:50] <amee2k> alternatively use the Vds/Id chart and see where the graph "levels out"
[09:48:25] <rhumbot> http://www.datasheetcatalog.org/datasheet/irf/irlml2803.pdf if i look at it correctly the drain-source current is up to 3A for 4.5V gate-source? it does not matter if i dont need that much right?
[09:51:22] <amee2k> no, thats just the maximum that the transistor will pass for a given gate source voltage
[09:52:02] <amee2k> in this case you even have an Rds(on) spec for 4.5V, actually. thats good for switching
[09:54:19] <amee2k> if you have an Rdson spec you can treat the transistor like a resistor when it is switched on in the circuit analysis
[10:45:39] <Landon> ooh, fancy new digikey catalog
[11:37:13] <RikusW> http://www.microvideox.com/spyfinder.htm
[11:43:53] <Suner> hey everyone, I'm trying to program an AVR on a breadboard with my dragon for the first time and I'm running into problems. basically avr studio keeps complaining that the device ID being read is invalid, although if I cycle power to the mcu it will read the correct ID the first time and not complain, but after that it doesn't. any ideas?
[11:45:28] <RikusW> Which AVR and are you using ISP or JTAG ?
[11:45:56] <RikusW> and are you using AS5 or avrdude ?
[11:46:22] <RikusW> ah AS
[11:46:47] <Suner> AS6 with ISP and atmega328p
[11:47:04] <RikusW> what ISP clock speed do you use ?
[11:47:32] <RikusW> and what is the m328p clock ?
[11:47:56] <Suner> was trying 125K, but I've fiddled around with the speed, doesn't matter, m328 clock is 8Mhz with ckdiv set
[11:48:14] <RikusW> 125K should be fine for 1MHz
[11:48:44] <RikusW> did you mess with the DWEN or clock fuses ?
[11:49:23] <Suner> nope,
[11:49:53] <Suner> like I said, it reads okay the very first time (after power cycle), and then fails to read every time after that
[11:50:01] <RikusW> What is the brownout fuse setting ?
[11:50:20] <Suner> disabled
[11:50:37] <RikusW> and what voltage are you using for the avr ?
[11:50:45] <Suner> 5V
[11:51:40] <RikusW> everything seems ok...
[11:52:30] <RikusW> how do you power the avr, from the dragon or seperate psu ?
[11:52:45] <Suner> from dragon
[11:53:20] <RikusW> it might be a loose wire....
[11:54:21] <Suner> nope, power's not the issue, double checked that, and tried using my psu also
[11:54:28] <Suner> not quite sure what's wrong
[11:54:35] <RikusW> how do you power cycle ? by unplugging the dragon ?
[11:54:47] <RikusW> me neither :-/
[11:55:38] <Suner> unplugged dragon or unplugging the wire going to vcc on mcu, same results
[11:55:48] <RikusW> maybe abcminiuser will have some advice ?
[11:56:06] * abcminiuser to the rescue!
[11:56:09] * abcminiuser reads scrollback
[11:56:35] <RikusW> so if you click on read signature twice it reads an invalid signature the second time ?
[11:56:47] <Suner> yep
[11:57:19] <RikusW> thats a bit odd... I haven't encountered that yet
[11:57:22] <abcminiuser> There was a bug in the dragon teardown process for dW that was patched
[11:57:25] * RikusW also have a dragon :)
[11:57:27] <abcminiuser> But IIRC ISP should be fine
[11:57:31] <abcminiuser> Don't have a dragon here to test it ATM
[11:59:11] <RikusW> Suner: so you haven't used dW yet ?
[11:59:22] <Suner> not yet
[11:59:34] <Suner> so it shouldn't be a factor I would assume?
[11:59:41] <RikusW> no
[12:00:21] <RikusW> maybe abcminiuser could look into that at work ?
[12:00:43] <RikusW> It does sound a bit strange to me
[12:02:27] <RikusW> Hi Steffanx
[12:02:44] <Steffanx> Hello RikusW
[12:04:00] <RikusW> You just missed an ISP programming problem, on AS6 the dragon reads a m328p signature fine first time, but not a second time...
[12:04:26] <Steffanx> Waow :)
[12:05:31] <RikusW> All the usual suspects eliminated, so I'm not sure what it is, apart from an AS6 bug...
[12:06:24] <Suner> will try with avrdude in a moment
[12:06:42] <RikusW> Suner: do you have Linux too ?
[12:06:43] <DSOlover> need im struggling to kickstart avr using atmel studio , i need good tutorials to learn the basics.
[12:07:07] <Suner> RikusW, nope
[12:07:09] <RikusW> Suner: the bug (if it is one) could be in the dragon fw too...
[12:07:10] <Suner> windows
[12:07:45] <Suner> that would be mighty unlucky, as6 just forced me to do an upgrade when I connected my dragon
[12:07:48] <RikusW> DSOlover: se the urls in the topic
[12:08:18] <RikusW> Suner: it can be downgraded again
[12:08:43] <DSOlover> RikusW: thanx
[12:08:56] <karlp> the "getting started" link in the first url there talks about assembler
[12:09:04] <karlp> why would I want to ever follow any advice on that page?
[12:09:12] <RikusW> toms site is nice
[12:10:14] <RikusW> karlp: so far I've coded mostly in asm for AVR, so why not ;)
[12:13:27] <RikusW> DSOlover: so do you have a AVR programmer yet ?
[12:13:36] <DSOlover> yes
[12:13:46] <RikusW> what kind ?
[12:13:59] <DSOlover> usbasp using an atmega8
[12:14:22] <RikusW> that wont work with AS, you'll have to use avrdude with it
[12:15:35] <DSOlover> ok, i will learn to programme through avr dude
[12:15:41] <DSOlover> im fluent with electronics but started learning Uc recenly , so i will need lots of help from u people
[12:17:00] <RikusW> avrdude is commandline only...
[12:18:54] <DSOlover> ok,
[12:19:25] <Suner> RikusW: just tested with avrdude and seems to work perfectly fine, looks like it's an AS6 problem
[12:20:09] <DSOlover> i flash the .hex file using sinaprog
[12:21:00] <RikusW> AS6 only supports official Atmel programmers
[12:21:10] <RikusW> afaik anyways
[12:21:59] <RikusW> Suner: sent atmel a mail about it ;)
[12:25:43] <RikusW> *send
[12:26:51] <Suner> RikusW: yep, will do
[12:27:17] <Steffanx> Maybe you'll get an answer from abcminiuser :)
[12:37:28] <RikusW> Suner: he does work for Atmel you know ;)
[12:42:31] <abcminiuser> Hva?
[12:43:46] <abcminiuser> What was the question?
[12:43:52] <Steffanx> at
[13:14:34] <amee2k> hmm.. do peltiers work the same on rectified unfiltered AC as on DC?
[15:36:23] <JyZyXEL> what was that better way of declaring "unsigned int"
[15:36:37] <JyZyXEL> something like "uint_16" was it?
[15:37:53] <kobsu> uint16_t?
[15:38:05] <JyZyXEL> what does the _t stand for?
[15:38:11] <kobsu> "type"
[15:39:05] <JyZyXEL> would it work similariry for "ulong32_t"
[15:39:20] <kobsu> it's a common habbit to add "_t" for additional types, though not necessary
[15:39:47] <karlp> JyZyXEL: [u]int{8,16,32,64}_t
[15:43:26] <kobsu> JyZyXEL: no it does not work similarly, uint16_t can represent max 65 535 and uint32_t 4 294 967 295... it's about what you need... if 16 bit is enough use that
[16:36:24] <JyZyXEL> micros() - Returns the number of microseconds since the Arduino board began running the current program.
[16:36:31] <JyZyXEL> is there something like that for avr-libc?
[16:38:14] <LoRez> you'd have to start it up yourself.
[16:40:43] <JyZyXEL> so would i use like one of those Timer/Counter things to increment a variable every microsecond?
[16:42:19] <LoRez> that would seem wasteful.
[16:43:07] <LoRez> maybe increment it every overflow and do math to figure out how many overflows and current counts you're at when you ask for micros
[16:44:31] <JyZyXEL> should i use a 8-bit or 16-bit counter?
[16:45:36] <LoRez> yes
[16:46:03] <JyZyXEL> which one is better suited though?
[16:46:36] <LoRez> depends on what you have free. the overflow interrupt will run more frequently with the 8 bit for obvious reasons.
[16:46:57] <JyZyXEL> well i have both free
[16:47:12] <JyZyXEL> guess ill got with the 8-bit one
[16:47:35] <drgreenthumb> I think 8 bit ends up needing more storage room for the same tick count. if you're overflowing more often your counter will overflow quicker too.
[16:48:16] <LoRez> it's going to be the same number of bits, just a matter of where those bits are.
[16:49:36] <JyZyXEL> boy this counter stuff seems complicated on the datasheet
[16:49:54] <karlp> it can do many things.
[16:50:13] <JyZyXEL> well i guess i only need to get it running
[16:50:20] <JyZyXEL> in microsecond resolution
[16:51:13] <JyZyXEL> and enable the overflow interrupt
[16:52:21] <drgreenthumb> well in both cases, 8 bit or 16 bit overflow, you just increment some external counter right? in 16 bit case, each positive value in the counter represents 65536 ticks, where 8 bit represents 256 ticks. also since 16 bit overflows less often, fewer interrupts, less busywork code. I'd use 16bit if possible
[16:52:45] <JyZyXEL> oh well ill just use that then
[16:54:29] <LoRez> do you really need to know when .000001 seconds have elapsed?
[16:55:04] <JyZyXEL> yeah in a 32 bit overflowing counter
[16:55:26] <LoRez> uh, wtf are you doing at that speed?
[16:55:42] <JyZyXEL> decoding RF signals
[16:55:53] <JyZyXEL> the algorithm was written for arduino
[16:55:53] <LoRez> a 16MHz arduino will execute only 16 instructions in that time.
[16:56:37] <JyZyXEL> says in the doc that it takes 70 minutes to overflow on a 16 MHz arduino
[16:57:25] <JyZyXEL> in any case all the decoding is based on this micros()
[16:57:51] <LoRez> are you sure it's not milliseconds?
[16:58:15] <JyZyXEL> it says microseconds
[16:58:42] <JyZyXEL> this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four).
[16:59:27] <LoRez> 2^32/1000000/60 =~ 71
[16:59:29] <LoRez> weird.
[17:00:04] <JyZyXEL> ill need to have the same micros() stuff for any of this to work
[17:00:16] <LoRez> or fix it to not depend on it.
[17:00:43] <drgreenthumb> heh yeah just rewrite for _dealy_us().
[17:00:48] <drgreenthumb> _delay*
[17:01:46] <JyZyXEL> i won't have a clue how to rewrite this
[17:03:08] <LoRez> adding delays is probably not what's called for
[17:03:32] <JyZyXEL> knowing the duration between events is called for
[17:03:49] <drgreenthumb> ah
[17:04:07] <JyZyXEL> its stuff like: long time = micros(); duration = time - lastTime; if (duration > 5000 && duration > RCSwitch::timings[0] - 200 && duration < RCSwitch::timings[0] + 200) {
[17:04:37] <karlp> this is where real men use input capture
[17:08:05] <Steffanx> No real men here karlp
[17:08:57] <LoRez> karlp: you're assuming it's appearing as input directly.
[17:09:40] <JyZyXEL> im sure someone has implemented counter like this already
[17:09:49] <JyZyXEL> i just wonder how the heck am i gonna find one with google
[17:11:00] <JyZyXEL> http://forum.bildr.org/viewtopic.php?f=17&t=386&p=3337
[17:11:10] <JyZyXEL> a version of millis()
[17:14:55] <JyZyXEL> i hope this is not one of those cases where one might think its trivial to use that to implement a version of micros() and then its gonna turn out to be very much non-trivial
[20:44:11] <electronics-cat> captain fred
[20:44:48] <Tom_itx> captain hook
[20:45:00] <electronics-cat> hii
[21:00:53] <electronics-cat> GuShH:
[21:01:00] <electronics-cat> come back
[21:02:04] <GuShH> no
[21:02:12] <GuShH> electronics-cat: get rid of the dipshits first
[21:02:23] <Tom_itx> ?
[21:02:31] <GuShH> the ones in ##electronics.
[21:02:32] <electronics-cat> GuShH: i can't really do that ey
[21:02:40] <GuShH> Me neither.
[21:02:46] <electronics-cat> how have you been anyway man?
[21:03:37] <Tom_itx> they have like 10 ops
[21:03:44] <Tom_itx> are they all that lazy?
[21:03:56] <GuShH> Yes. they're never around
[21:04:00] <electronics-cat> nah the idiots live there permanently
[21:04:07] <GuShH> I've had to ask for help on #freenode about... 10 times.
[21:04:13] <electronics-cat> canucks etc
[21:04:16] <GuShH> So a staffer would come and ban whoever was bothering.
[21:04:32] <electronics-cat> those fucking preekz
[21:04:43] <Casper> nobody in the oplist of ##electronics do anything about trolls, flooder, spammers or whatever
[21:04:58] <Casper> some even mysteriously dissapear when trouble come
[21:05:05] <GuShH> then I would get called names and insulted on PM all the time.
[21:05:19] <Casper> exactly like the guys at home depot when you need them
[21:05:24] <GuShH> LOL
[21:05:36] <GuShH> Yes, they scatter.
[21:05:49] <Casper> a funny thing is
[21:05:57] <GuShH> The trick is... don't turn your head around, they see this and they run.
[21:06:31] <Tom_itx> well no need to bring other channel problems here
[21:06:51] <Tom_itx> yeah i've noticed that about HD
[21:06:59] <Casper> the other day' I walk to the service desk, and before I have time to ask them they go: "I'm sure you have a question for you!" "yup, how did you knew?" "We can smell it far away!" "Oh.. that's why when we need someone they dissapear? they smell us comming?" :D
[21:07:09] <Tom_itx> we got a menards recently and they're rather helpful
[21:07:34] <Tom_itx> giving HD and Lo a run for their money
[21:07:37] <Casper> HD is good compared to Rona and Reno Depot
[21:08:18] <Casper> the problem with rona is: there is ONE guy in electricity.... that also do the 2 departement beside it... but... somehow he end up being in the plumber departement
[21:08:30] <Casper> so never there when you need him
[21:35:25] <JyZyXEL> so if i wanna count microseconds with an AVR running at 10MHz i calculate: ((1/1,000,000) / (1/10,000,000) - 1) = 9
[21:35:49] <JyZyXEL> that would mean every 9 counts would mean 1 microsecond
[21:36:05] <JyZyXEL> is my math correct?
[21:39:51] <Casper> no
[21:40:51] <Casper> 1 cycle is 1/10e6 of a second, or 100e-9 second long, or 0.1uS long
[21:41:02] <Casper> 10 cycles would be needed for 1us
[21:42:50] <JyZyXEL> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=50106
[21:42:56] <JyZyXEL> so is the tutorial wrong
[21:43:14] <JyZyXEL> for some reason it has -1 at the end
[21:44:45] <Casper> that's for the timer value
[21:44:54] <Casper> as 0 is also to be included
[21:47:39] <JyZyXEL> im sure im not the only one who forgot about 0 being included in the count
[22:56:33] <JyZyXEL> haha i actually got it to work on the first try
[22:57:10] <JyZyXEL> if (micros() > 10000000L) turned on the LED after 10 seconds had passed :p
[22:57:36] <Casper> what resolution do you need?
[22:58:44] <JyZyXEL> eight microseconds
[23:00:33] <JyZyXEL> this is how i did it: http://pastebin.com/XDMTXJYb
[23:02:02] <JyZyXEL> its stolen from arduino libs
[23:02:19] <JyZyXEL> i didn't really get whats with all the volatile variable stuff
[23:14:51] <Tom_itx> volatile means to read it no matter what
[23:15:11] <Tom_itx> because an external source could change it, ie an interrupt
[23:16:23] <JyZyXEL> read it when? and no matter what as opposed to what?
[23:18:20] <Tom_itx> re read it every time it's called
[23:18:35] <Tom_itx> and assume it has been changed by an outside source
[23:18:54] <JyZyXEL> what else is there to do than to read it every time its called?
[23:19:30] <Tom_itx> write to it
[23:20:54] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/abcminiuser/articles/avr_interrupts_index.php
[23:20:58] <Tom_itx> read part 5
[23:21:43] <Tom_itx> Without the volatile keyword, the compiler may optimize out accesses to a variable you update in an ISR, as the C language itself has no concept of different execution threads
[23:28:54] <JyZyXEL> no concept of threads and yet thats what everyone is doing!
[23:30:05] <Xark> JyZyXEL: It is not just for threads/interrupts. For example a memory mapped I/O location probably wants to be marked volatile (so the compiler won't cache the variable in a register and use a "stale" value).