TCON control word and TMOD register

Publisher:EternalSunsetLatest update time:2019-06-03 Source: eefocusKeywords:TCON Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

TCON: Timer Control Register

Register address 88H, bit addressing 8FH~88H

 

 Bit Address

 8F

 8E

 8D

 8C

 8B

 8A

 89

 88

 Bit Notation

 TF1

 TR1

 TF0

 TR0

 IE1

 IT1

 IE0

 IT0

 

TF0(TF1)——Count overflow flag, when the counter overflows, this position is 1.

TR0 (TR1) - timer operation control bit

When TR0 (TR1) = 0, stop the timer/counter

When TR0 (TR1) = 1, the timer/counter starts working.

IE0 (IE1) - External interrupt request flag

When the CPU samples P3.2 (P3.3) and detects a valid interrupt request, this bit is set to 1 by hardware. After the interrupt response is completed and the interrupt service is turned to, it is automatically cleared to 0 by hardware.

IT0 (IT1) - External interrupt request signal mode control bit

When IT0 (IT1) = 1, pulse mode (negative edge jump is valid)

When IT0 (IT1) = 0 level mode (low level is valid), this bit is set or cleared by software.

TF0 (TF1)——Count overflow flag

When the counter overflows, this bit is set to 1 by hardware. When the interrupt service is turned, the hardware automatically clears it to 0. There are two situations for using the overflow flag: when the interrupt mode is used, it is used as an interrupt request flag; when the query mode is used, it is used as a query status bit.

 

TMOD register Timer/counter T0¦T1 mode register 

GATE

 C/T

 M1

 M0

 GATE

 C/T

 M1

 M0

 

The lower four bits define timer/counter T0, and the upper four bits define timer/counter T1. Explanation of each bit:

Ⅰ, GATE - Gate control.
When GATE = 1, the timer is started by the external interrupt pins INT0, INT1 and the control register TR0, TR1.

When GATE=0, timers T0 and T1 are started only by setting TR0 and TR1.
Ⅱ, C/T - Function selection bit

  When set, select the counting function, and when cleared, select the timing function.

 Ⅲ, M0, M1——Mode selection function

  Since there are 2 bits, there are 4 ways to work

  ================================================================

  M1M0 working mode counter mode TMOD (set timer mode)

  0 0 Mode 0 13-bit counter TMOD = 0x00

  0 1 Mode 1 16-bit counter TMOD = 0x01

  1 0 Mode 2 Automatically reload 8-bit counter TMOD=0x02

  1 1 Mode 3 T0 is divided into two 8-bit counters, T1 is the baud rate generator TMOD=0x03

  ================================================================


Keywords:TCON Reference address:TCON control word and TMOD register

Previous article:Common models of STC microcontrollers
Next article:Keil creates a multi-file project

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号