8051 Microcontroller

MICROCONTROLLER
             Microcontroller is a general-purpose device, but one that is meeting to read data performs limited calculation on data, and contained is its environment based on these calculations. The prime use, of Microcontroller is to control the operation of a machine using a fixed program that is stored in and does not change over the lifetime of the system.
           The microcontroller design uses a much more limited set of single and double byte instructions that are used to move code and data from internal memory to the ALU. Many instructions are coupled with pins on the IC package; the pins are “programmable” that is, capable of having several different functions depending on the wishes of the programmer. The microcontroller is concerned with getting data from and its own pins: the architecture and instruction set are optimized to handle data in bits and byte size.
        Microcontroller will have much type of bit handling instructions. It may have operational code for moving data from external memory to CPU. Microcontroller may have one or two concerned with rapid movement of code and data from external address.

·         The Intel 8051 is an 8bit microcontroller
·         1 serial port
·         2 timer
·         2 ,16 bit counter  counter/timer
·         3 internal and 2 external  interrupts
·         4kb   internal ROM.
·         4 number of 8 bit parallel I/O ports (32 pin).
·         4 register bank.
·         6 interrupt
·         Maximum internal clock frequency rating is 12 MHZ
·         16 bit DPTR (DPH (8)+DPL(8) )
·         16 bit PC (program counter)
·         40 pin IC (DIP).
·         128 byte internal ram
·         8051 has an on chip oscillator


      
Pin 1-8 port:  these pin can be configure as an input/output
Pin 9 RESET: A logic one on this pin disables the microcontroller and clears the content of most         registers.
Pin 10 RXD: Serial asynchronous communication input or serial asynchronous communication output
Pin 11 TXD: Serial asynchronous communication input or serial asynchronous communication clock output
Pin 12: INTO interrupt 0input
Pin13: INT1 interrupt 1 input
PIN 14: T0 counter 0 clock input.
Pin 15:T1 counter 1clock input.
Pin 16: WR write to external RAM
Pin 17: RD Read from external RAM
Pin 18: XTAL1, XTAL2- Internal oscillator input and output .It Is an in built oscillator which derives the necessary clock frequency for the operation controller.XTAL1 is the input of the inverting amplifier that forms the oscillator XTAL1 should be grounded when an external oscillator used. XTAL2 is the output of the inverting amplifier that forms the oscillator and input to the internal clock generator.
Pin 20: VSS  - This is a  GNG ground.
Pin 21-28: port 2 acts as an 8 bit bidirectional bit address able. These port pin are configured as general input/output. It is given address in the SFR address range.
Pin 29: PSEN  If external ROM is used for storing program then a logic 0 appears on it every time the microcontroller reads a byte from memory. Program store enable is an active low output signal that acts as a strobe to read external program memory.
Pin 30: ALE /PROG –The Address Latch Enable (ALE) - This pin used to de-multiplex the address and data bus. This ALE signal is valid only for external memory accesses.
Pin 31 EA/ Vpp - External access enable pin if held low. For execution of program in internal memory  , the EA  must be held high. By applying logic one to the EA PIN, the micro controller will use both memories, first internal then external.
Pin- 32-39: These pins can be used as general inputs/outputs. Otherwise, p0 is configured as address output (A0-A7) when the ale pin is driven high (1) or as data output when the ALE pin driven low (0)
Pin- 40: VCC  This a +5v dc supply voltage pin.
A register (accumulator)
A register is a general- purpose memory used for storing intermediate results obtained during operation. The accumulator has been allotted an address in the on- chip special function register bank.
B register
Multiplication and division can be performed only upon number stored in A and B register .for other    instruction , it can be used as a scratch.            
DPTR (Data Pointer Register)
It consist of two separate register: DPH (Data Pointer High) DPL (Data Pointer Low) Its instead function is to hold a 16 bit address.

PSW (Program Status word) Register
PSW is one of most important SFRS. It contains several status  bit that reflected the current state of the CPU.
Overflow Flag
Over flow flag is used to detect error in signed arithmetic operations.
Carry Flag
Carry flag is used to detect error in unsigned arithmetic operations.
Stack pointer (SP)
 It is 8-bit wide. SP generally starts the end of the data memory and is decremented with every PUSH incremented with every POP.  While the stack may reside anywhere in on-chip RAM.
SFR (Special Function Register)
SFRs are a sort of control table used for running and monitoring the operation of the microcontroller. There are 21 addressable  8bit-bit register - A, B ,PSW, P0, P2, P2, P3, IP,IE, TCON and SCON. The other  11 Registers to be addressed as byte are SP ,DPH,DPL,TMOD,TH0,TH1,TL0,TL1,PCON,SBUF register.

TIMER/CONUTER
Two 16 bit timer/counter register
· timer/counter 0
· timer/counter 1
Timer - incremented every machine cycle . Counter – incremented when there is 1 to 0 transition at its external input pin, pin T0 or T1.They can configured in any of the four operating modes. The timer consists of two bit register called TH and TL. A machine cycle consists of 12 oscillatory periods. Which one selected by bit- pair (M1,M0) in register TMOD. Mode 0,1 and 2 are the same for  both the timer/counters. Mod 3 is different.
Timer 1 and timer0
The timer\counter function is selected by  C\T in TMOD register. The form operating modes are selected by M1 , M0  in TMOD.
mode0
Timer in mode 0 is an 8 bit counter with a divided by 32 prescaler.  In this node, the timer  register is configured as 13 bit register .As the count rolls over from all 1s to 0s,it reset interrupt flag TF1.The input in enable to the Timer  when TR1 =1 and either GATE =0. The 13 bit counter can hold values between 0000 to 1FFFH in TH and TL.


Mode1
Mode 1 is same as mode 0 ,except that the Timer register is configured as 16 bit register.
MODE 2
MODE 2 configured the timer register as an 8bit counter  (TRI) with automatic reload. Overflow from TL1 not only sets TF1, but also reloads  ,TL1 with the contents of TH1, which is present by software.
Mode3
Mode3 is different for Timer 1 and Timer 0. TIMER 1 just holds its count. It operates the same as when TR1 is set to 0.Timer 0 in mode 3 establishes TL0 and THO as two separate counter.
TMOD

The TMOD register selected the operation mode of TIMER T0 and T1.

Post a Comment

0 Comments