Study of 8051 Micro Controller Architecture

9
STUDY OF 8051 MICRO CONTROLLER ARCHITECTURE Ex no:1 Date: Aim: To study about 8051 micro controller architecture 8051 microcontroller pins PIN1-8: Port 1 each of these pins can be configured as input or output PIN 9: Rs logical one on this pin stop microcontroller’s operating and erases the contents of most registers. By applying the logical zero to the pin, the program starts execution from the beginning. In other words, a positive voltage pulse on this pin resets the microcontroller. PINS 10-17: Port3 similar to port 1, each of these pins can serve as universal input or output. Besides, all of them have alternative functions PIN 10: Rxd serial asynchronous communication input or serial synchronous communication input

Transcript of Study of 8051 Micro Controller Architecture

Page 1: Study of 8051 Micro Controller Architecture

STUDY OF 8051 MICRO CONTROLLER ARCHITECTURE

Ex no:1

Date:

Aim:

To study about 8051 micro controller architecture 8051 microcontroller pins

PIN1-8:

Port 1 each of these pins can be configured as input or output

PIN 9:

Rs logical one on this pin stop microcontroller’s operating and erases the contents of most registers. By applying the logical zero to the pin, the program starts execution from the beginning. In other words, a positive voltage pulse on this pin resets the microcontroller.

PINS 10-17:

Port3 similar to port 1, each of these pins can serve as universal input or output. Besides, all of them have alternative functions

PIN 10:

Rxd serial asynchronous communication input or serial synchronous communication input

PIN 11:

txd serial asynchronous communication output or serial synchronous communication output

PIN 12: int0 interrupt 0 input

PIN13: int1 interrupt 1 input

PIN14: t0 counter 0 clock input

PIN15: t1 counter 1 clock input

Page 2: Study of 8051 Micro Controller Architecture

PIN16: wr signal for writing to external (additional) ram

PIN 17: RD signal for reading from external RAM

Block Diagram of 8051

PIN 18, 19:

X2, X1 internal oscillator input and output. A quartz crystal is connected to these pins to generate operating frequency

PIN 20: Ground

PIN 21-28:

Page 3: Study of 8051 Micro Controller Architecture

Port 2 configured as inputs and outputs. In the case of external memory being used these offer the address A8-A15.

PIN 29:

PSEN if external ROM is used for storing program then it has logic 0 value every time the microcontroller reads from memory.

Pin diagram of 8051

PIN 30:

ALE prior to each reading from external memory, the controller will set the low address on P0 and after that activates the output ALE. In the second part of the microcontroller machine cycles, a signal stops and P0 is used for data transmission.

PIN 31:

EA by applying logic zero to this pin ,P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. That

Page 4: Study of 8051 Micro Controller Architecture

means even if program is there on the controller it will not be executed. Applying logic one to EA the controller will use both the memories.

PIN 32: Port 0 is similar to port 2, if external memory is accessed.P0 provides the lower address byte (A0-A7).

PIN 40: Vcc Power supply +5v.

SPECIAL FUNCTION REGISTER:

These registers are a kind of control table used for running and monitoring the microcontroller operation. There are only 21 registers of this type.

Accumulator:

A general purpose register for storing immediate values during operation.

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0

B register:

It is used during multiplication and division along with the A register.

R Register (R0-R7):

Common general purpose registers used during any operation of the microcontroller.

PSW Registers:

The Program Status Register contain several bits that reflect the current state of the CPU.

CY AC F0 RS1 RS0 OV - P

Page 5: Study of 8051 Micro Controller Architecture

CY-carry

AC-Auxillary carry

RS1,RS0 –Register Bank Select

OV –Over flag

P-Parity.

DATA POINTER REGISTER (DPTR):

These are 16-bits wide for external memory addressing. They are divided into DPH (Data Pointer High) and DPL (Data Pointer Low).

Stack Pointer(SP):

It points to the RAM and permits the stack availability .It is 8-bit wide. After reset it points to address of 7 of the memory.

Counter and Timers:

The 8051 has 2 timer, each 16-bit wide. their main purpose is for counting occurrences of external events and measuring the time.

T0: when timer 0 is equal to 0 then both registers will include 0 value.

If the timer register contains a value of then accordingly its value is either used for counting or for timing.

TMOD Register:

Gate1 C/T TM1 TM0 Gate0 C/T TM1 TM0

Writing into these will select the timer and their mode of operation.

TM1 TM0 Mode description

0 0 0 13-bit timer

Page 6: Study of 8051 Micro Controller Architecture

0 1 1 16-bit timer

1 0 2 8-bit auto reload

1 1 3 Split mode

Gate: starts the timer 1 using a signal provided to the pin INTO(P3.2)

C/T0 =1; timer operation else counter operation

TCON REGISTER:

TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0

TF1-automatically set when timer1 overflows

TR1=1; timer1 on else timer off

TF0-automatically set when timer0 overflows

TR0=1; timer1 on else timer0 off

UART:

It’s a duplex port for serial communication which means it can receive and transmit data serially. Serial data is sent by writing into SBUF register. SBUF is an 8-bit register. All bits used for controlling the serial communication is done with the help of the SCON register.

SM0 SM1 SM2 REN TB8 RB8 TI RI

SMO,SM1,SM2 –For mode selection

Page 7: Study of 8051 Micro Controller Architecture

REN-receive enable

TI-set during transmission

RI-set during reception

SM0 SM1 MODE Description Baud Rate

0 0 0 8-bit shift register

1/12 quartz frequency

0 1 1 8-bit uart From timer 1

1 0 2 9-bit uart 1/32 quartz frequency

1 1 3 9-bit uart From timer 1

RESET: Reset occurs when RS=1.Here all internal registers are reset by the microcontroller