Electronic Circuits - Electronic Tutorials - Electronic Hobby Projects - A Complete Electronic Resource Centre

MICROCONTROLLER TUTORIALS - 8051

Videos

Products

Sitemap

Circuits

Tutorials

8051

Introduction

Chapter 1
Types of Memory

Chapter 2
Special Function Registers

Chapter 3
Basic Registers

Chapter 4
Addressing Modes

Chapter 5
Program Flow

Chapter 6
Low Level Information

Chapter 7
Timers

Chapter 8
Serial Port Operations

Chapter 9
Interrupts

Additional Features in 8052

8052 Instruction Set

8051 Microcontroller
TCON SFR

Author : Craig Steiner

Source : 8052.com

Book : The 8051/8052 Microcontroller:
       
 Architecture, Assembly Language, And Hardware Interfacing (Paperback)

The TCON SFR

Finally, there’s one more SFR that controls the two timers and provides valuable information about them. The TCON SFR has the following structure:

TCON (88h) SFR

Bit

Name

Bit Address

Explanation of Function

Timer

7

TF1

8Fh

Timer 1 Overflow. This bit is set by the microcontroller when Timer 1 overflows.

1

6

TR1

8Eh

Timer 1 Run. When this bit is set Timer 1 is turned on. When this bit is clear Timer 1 is off.

1

5

TF0

8Dh

Timer 0 Overflow. This bit is set by the microcontroller when Timer 0 overflows.

0

4

TR0

8Ch

Timer 0 Run. When this bit is set Timer 0 is turned on. When this bit is clear Timer 0 is off.

0

As you may notice, we’ve only defined 4 of the 8 bits. That’s because the other 4 bits of the SFR don’t have anything to do with timers--they have to do with Interrupts and they will be discussed in the chapter that addresses interrupts.

A new piece of information in this chart is the column "bit address." This is because this SFR is "bit-addressable." What does this mean? It means if you want to set the bit TF1--which is the highest bit of TCON--you could execute the command:

MOV TCON, #80h

... or, since the SFR is bit-addressable, you could just execute the command:

SETB TF1

This has the benefit of setting the high bit of TCON without changing the value of any of the other bits of the SFR. Usually when you start or stop a timer you don’t want to modify the other values in TCON, so you take advantage of the fact that the SFR is bit-addressable.


<<< Click here to come back on (8051 - Timers)

<<<<  Back to 8051 / 52  Microcontroller Tutorial