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

8051 timer to sleep for a few second

Does anybody know how to set 8051 timer to sleep for a few second and then wake up by itself?

Parents
  • The statement clears the low four bits of the TMOD register, while leaving the upper four bits unchanged.

    The comment would indicate that this is intended to put timer 0 into 16-bit timer mode, without any prescaling. You could check the manual for the chip to see what clearing those bits really does on this part. According to the documentation for my variant, setting the low two bits of TMOD to 0 makes Timer 0 a 13-bit timer (or 8-bit timer with a 5-bit prescaler, if you prefer). Perhaps this code is correct for an 8051fx, or perhaps the comment is wrong. You'll have to check the documentation to be sure. (And try an experiment yourself really to be certain!)

Reply
  • The statement clears the low four bits of the TMOD register, while leaving the upper four bits unchanged.

    The comment would indicate that this is intended to put timer 0 into 16-bit timer mode, without any prescaling. You could check the manual for the chip to see what clearing those bits really does on this part. According to the documentation for my variant, setting the low two bits of TMOD to 0 makes Timer 0 a 13-bit timer (or 8-bit timer with a 5-bit prescaler, if you prefer). Perhaps this code is correct for an 8051fx, or perhaps the comment is wrong. You'll have to check the documentation to be sure. (And try an experiment yourself really to be certain!)

Children
No data