I'm not sure how the Arduino environment handles interrupts, but in C you need
to declare any variables altered by an interrupt as "volatile" so that the
compiler optimization routines know not to assume they contain known values.
Also any code that accesses them needs to do so with interrupts turned off...
otherwise you can wind up with corrupted values. Imagine that the mainline
code is accessing a multi-byte variable. The code accesses the lower byte, in
comes an interrupt that changes the variable (new low and high bytes, then the
interrupt routine returns to the mainline code), and then the mainline code
proceeds to access the (now changed) high byte of the variable... the
resulting value is a mishmash of the old and new values.
_______________________________________________
time-nuts mailing list -- [email protected]
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.
- Re: [time-nuts] First succe... Chris Albertson
- Re: [time-nuts] First succe... Tom Miller
- Re: [time-nuts] First succe... d0ct0r
- Re: [time-nuts] First succe... paul swed
- Re: [time-nuts] First succe... paul swed
- Re: [time-nuts] First succe... d0ct0r
- Re: [time-nuts] First succe... Edesio Costa e Silva
- Re: [time-nuts] First success with v... d0ct0r
- Re: [time-nuts] First success w... Tom Van Baak
- [time-nuts] First success with very simple, very low ... Mark Sims
- Re: [time-nuts] First success with very simple, ... Hal Murray
- Re: [time-nuts] First success with very simp... Orin Eman
- Re: [time-nuts] First success with very ... Chris Albertson
- Re: [time-nuts] First success with v... Hal Murray
- Re: [time-nuts] First success w... Chris Albertson
- Re: [time-nuts] First success with very simp... Chris Albertson
- Re: [time-nuts] First success with very simple, ... Chris Albertson
- Re: [time-nuts] First success with very simp... Hal Murray
- Re: [time-nuts] First success with very ... Chris Albertson
