intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 7.1 SPECIAL FUNCTION OPERATORS TCON The TCON operator is used to retrieve and/or assign value to the 8052AH's special function register TCON. TCON is a byte register that is used to enable or disable TIMER0 and TIMER1, plus the interrupts that are associated with these timers. Additionally, TCON determines whether the external interrupt pins on the 8052AH are operating in a level sensitive or edge-triggered mode. MCS BASIC-52 initializes TCON with the value 244 (0F4H) and assumes that it is never changed. The value 244 (0F4H) places both TIMER0 and TIMER1 in the run (enabled) mode.

If the user disables the operation of TIMER0, by clearing BIT 4 in the TCON register, the REAL TIME CLOCK will NOT work. If the user disables the operation of TIMER1, by clearing BIT 6 in the TCON register, the EPROM programming routines, the software serial port. and the PWM statement will NOT work. Use caution when changing TCON!!! TMOD The TMOD operator is used to retrieve and/or assign a value to the 8052AH's special function register TMOD. TMOD is a byte register that controls TIMER0 and TlMER1's mode of operation. MCS BASIC- 52 initializes the TCON register with a value of 16 (10H).

The value 16 (10H) places TIMER0 in mode 0, which is a 13-bit counter mode and TIMER1 in mode 1, which is a 16-bit counter mode. MCS BASIC-52 assumes that the modes of these two timer/counters are never changed. If the user changes the mode of TIMER0, the REAL TIME CLOCK will not operate properly. If the user changes the mode of TIMER1, EPROM programming. the software serial port, and the PWM statement will not work properly. If the user does not use these features available in MCS BASIC-52, either timer/counter can be placed in any mode required by the specific application. - 90 -