We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Does anybody know how to set 8051 timer to sleep for a few second and then wake up by itself?
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!)