This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Tiner Inaccuracy

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

Parents
  • "I wanted a 1 second delay so I loaded timer 0 with these values: TH0=0xF1; TL0=0x99"

    At a glance your reload value doesn't look right for a 12 clock device at the frequency you stated.

    I'm not familiar with the device you're using so I can't offer the correct numbers, but all you have to do is establish from the datasheet the frequency at which T0 is clocked in relation to the oscillator frequency. It's straightforward to work out the reload value once you know this.

Reply
  • "I wanted a 1 second delay so I loaded timer 0 with these values: TH0=0xF1; TL0=0x99"

    At a glance your reload value doesn't look right for a 12 clock device at the frequency you stated.

    I'm not familiar with the device you're using so I can't offer the correct numbers, but all you have to do is establish from the datasheet the frequency at which T0 is clocked in relation to the oscillator frequency. It's straightforward to work out the reload value once you know this.

Children