int e l 7.1 SPECIAL FUNCTION OPERATORS The reason only the integer portion of TIME is changed when assigned a value is that it allows the user to generate accurate time intervals. For instance, let's say you want to create an accurate 12 hour clock. There are 43200 seconds in a 12 hour period, so an ONTIME 43200,[ln num] statement is used. Now, when the TIME interrupt occurs the statement TIME = 0 is executed, but the millisecond counter is not re-assigned a value so if interrupt latency happens to exceed 5 milliseconds, the clock will still remain accurate. TIMER0 The TIMER0 operator is used to retrieve or assign a value to the 8052AH's special function registers TH0 and TL0.
This operator treats the byte registers TH0 and TL0 as a 16-bit register pair. TH0 is the high byte and TL0 is the low byte. MCS BASIC-52 uses TH0 and TL0 to implement the REAL TIME CLOCK function. If the user does not implement the REAL TIME CLOCK function (i.e. does not use the statement CLOCK1) in the BASIC program TH0 and TL0 may be used in any manner suitable to the particular application. TIMER1 The TIMER1 operator is used to retrieve or assign a value to the 8052AH's special function registers TH1 and TL1. This operator treats the byte registers TH1 and TL1 as a 16-bit register pair TH1 is the high byte and TL1 is the low byte.
MCS BASIC-52 uses TH1 and TL1 to implement the timings for the software serial port, the EPROM programming feature, and the PWM statement. If the user does not use any of these features TH1 and TL1 may be used in any manner suitable to the particular application. TIMER2 The TIMER2 operator is used to retrieve or assign a value to the 8052AH's special function registers TH2 and TL2. This operator treats the byte registers TH2 and TL2 as a 16-bit register pair. TH2 is the high byte and TL2 is the low byte. MCS BASIC-52 uses TH2 and TL2 to generate the baud rate for the serial port.
If the user does not use TIMER2 to clock the serial port, TH2 and TL2 may be used in any manner suitable to the particular application. - 92 -