[time-nuts] First success with very simple, very low cost GPSDO, under $8

Mark Sims holrum at hotmail.com
Wed Apr 9 18:20:40 EDT 2014


Well,  where interrupts are involved,  NEVER assume something about how the code SHOULD/MIGHT be working.  It is easy enough to disable interrupts before accessing the volatile variables and restore them afterwards.  This is by far the simplest and most reliable way to do it correctly (no messy message passing/semaphores/smoke signals/etc).
unsigned char sreg;  // variable to save the processor status register in
sreg = SREG;   // save current processor status register

cli();     // disable interrupts in the status register

  // access variables here

SREG = sreg;  // restore original interrupt state ito the processor status register 		 	   		  


More information about the time-nuts mailing list