Special function registers are upper RAM memory in the 8051 microcontrollers. These registers contain all peripheral related registers like P0, P1, P2, P3, timers or counters, serial port and interrupts-related registers. The SFR memory address starts from 80h to FFh. The SFR register is implemented by bit-address registers and byte-address registers.
The accumulator and B registers and port registers all are bit addressable register remaining all are bye addressable registers.
Accumulator: The accumulator which is also known as ACC or A is a bit as well as a byte-addressable register by an address of the accumulator. If you want to use a bit-addressable register, you can use a single bit (E0) of the register and you can use an 8-bit of the accumulator as a byte-addressable register. The accumulator holds the results of most Arithmetic and logical operations.
B-Register
The B-register is a bit and byte-addressable register. You can access 1-bit or all 8-bits by a physical address F0h. Suppose to access a bit 1, we have to use f1. The B register is only used for multiplication and division operations.
Port Registers
The 8051 microcontroller consists of 4-input and output ports (P0, P1, P2, and P3) or 32-I/O pins. Each pin is designed with a transistor and P registers. The pin configuration is very important for a microcontroller that depends on the logic states of the registers. The pin configuration as input given by 1 or output 0 depends on the logic states. If logic 1 is applied to the bit of the P register, the output transistor switches off the appropriate pin that acts as an input pin.
Counters and registers:
Many microcontrollers consist of one or more timers and counters. The timers are used to generate precious time delay and the source for the timers is a crystal oscillator. The counters are used to count the number of external events – for instance, the objective counter, and the source for counters are external pulses applied across the counter pin.
The 8051 microcontroller consists of two 16-bit timers and counters such as timer 0 and timer 1. Both the timers consist of a 16-bit register in which the lower byte is stored in the TL and the higher byte is stored in the TH. The Timer can be used as a counter as well as for timing operation that depends on the source of the clock pulses to the counters.
The Counters and Timers in 8051 microcontrollers contain two special function registers: TMOD (Timer Mode Register) and TCON (Timer Control Register), which are used for activating and configuring timers and counters.
Well, in yesterday's podcast discussed on registers in 8051, two types of a register, general purpose registers are today's article all about. The general purpose registers are called as RAM memory in 8051. It has 128 bytes of memory for this general purpose registers. These general purpose registers are divided into 3 areas, those are Banks. Bit addressable areas. scratchpad areas. Let we discuss clearly, Banks In this bank, 4 types of banks are there like bank 0 bank 1 bank 2 bank 3 In each bank has 8 registers those are R0 to R7. All these general purpose registers are byte addressable registers. An image is shown in below for better understanding, ...
If a counter is programmed to be a timer, it will count the internal clock frequency of the 8051 oscillator 12d. As an example, if the crystal frequency 6 MHz, then the timer clock will have a frequency of 500kHz. The timers may operate in any one of four modes that are determined by the mode bits. In that the timer control TCON it is a special function register. TCON: Pin Description of TCON: Bit Symbol TCON Bit Function 7 TF1l Timer 1 Overflow flag. Set when timer rolls from all 1's to 0. Cleared when processor vectors to execute interrupt service routine located at program address 001Bh. 6 TR1l Timer 1 run control bit. Set to 1 by a program to enable the timer to count; cleared to 0 by the program to halt timer. 5 TF0 l Timer 0 Overflow flag. Set when timer rolls from all 1's to 0. Cleared when processor vectors to execute interrupt service routine located at program address 000Bh. 4 TR0l Timer 0 run control bit. Set to 1 by a program to ...
TMOD register As we know there are 2 timer registers in 8051. Timer 0 and timer 1. Both of these registers use the same register called TMOD to set various timer operation modes. TMOD is an 8-bit register, in which lower 4 bits are for Timer 0 and upper 4 bits are for Timer 1. See table below. MSB ---- LSB GATE C/T M1 M0 GATE C/T M1 M0 TIMER 1 TIMER 0 Bit Description: Bit TMOD Bit Function 7 Gate -- OR gate enable bit which controls RUN/STOP of timer 1. Set to 1 by the program to enable the timer to run if bit TR1 in TCON is set and the signal on external interrupt is high. Cleared to 0 by the program to enable time to run if bit TR1 is set. 6 C/ T -- Set to 1 by the program to make timer 1 act as a counter by counting pulses from external input pins 3.5. Cleared to zero by the program to make timer act as a timer by counting internal frequency. 5 M1 -- Timer/counter operating mode select bit 1. Set/cleared by the...
Comments
Post a Comment