Hello, I am using an MCB900 evaluation board for philips LPC935FA which uses a clock of 7.373MHz. I wanted a 1 second delay so I loaded timer 0 with these values: TH0=0xF1; TL0=0x99 (I used the code architect to get these values). I then used a counter in the software to count this 1,000 times. This ordinarily should give me 1 second delay after which an LED should be switched on. I have used a stop watch to check the accuracy of the timing and it lags behind by as much as 3 seconds. Could anyone help me as to the reason why this happens. Regards, Ade
to count this 1,000 times a guess: non-atomic read Erik
Sorry to bother you again, but what is a non-atomic read.
things like in an ISR an_int_named = ...; in a non interrupt section ... = an_int_named = ; if any variable of more than 8 bits is used both in an ISR and outside it MUST be handled inside disabled interrupt. Erik
"if any variable of more than 8 bits is used both in an ISR and outside it MUST be handled inside disabled interrupt." Or, if you don't want to mess up your interrupt latency, re-read the variable until its value is the same on consecutive reads.