Question about timer/counter in mcs-51

Thread Starter

Werapon Pat

Joined Jan 14, 2018
35
I learnt how to use timer/counter in mcs-51 by setting some values in register TMOD etc.
I wonder, what is the purpose to set the value of register THx or TLx to negative when we want to use timer mode. I saw someone does that and don't really know what does it mean.
 

Ian Rogers

Joined Dec 12, 2012
660
There are four timer modes 8 bit, 16bit, 8 bit with reload and 8 bit with prescaler!

M01 and M00.. ( bits 1 and 0 ) Mode.

00 = 8 bit Timer with pre-scaler (TLO = pre-scale)
01 = 16 bit timer.
10 = 8 bit timer with re-load. (TH0 = reload value )
11 = 8 bit timer with no pre-scaler.

00 Is like the pic version but has the full 255 resolutions ( pic has about 8 )
01 Is self explanatory
10 When TLO overflows the value in THO auto sets the timer.
11 Just an 8 bit timer..
 
Top