[time-nuts] First success with very simple, very low cost GPSDO, under $8
hmurray at megapathdsl.net
Wed Apr 9 09:08:27 UTC 2014
holrum at hotmail.com said:
> 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
> Also any code that accesses them needs to do so with interrupts turned
> off... otherwise you can wind up with corrupted values.
Not quite. That may be the simplest way, but you can also use inter-process
communications type tricks. The classic for a two byte counter is to read
high-low-high and try again if the high values don't match. That assumes the
interrupt routine updates low then (maybe) high.
These are my opinions. I hate spam.
More information about the Time-nuts_lists.febo.com