Sei sulla pagina 1di 20

8051

Microcontrollers

are contained within single integrated circuit. Microprocessor are the ICs containing ROM RAM, CPU Timer, Interrupt control, serial interface, parallel interface and It has 10 ports

it have 40 pins.

some can be operated in dual mode.

Port

Dul purpose port on pins 32-38 of 8051 Ics. In general used as I/O port.

For larger designs with external memory. It becomes a multiplexed address and data bus.

Port1

Dedicated for I/O on pins 1-8. These pins can be used for interface external devises. Also used for external input to third timer .

Port

Dual purpose port on pins 21-28. Serving general purpose I/O. OR more than 256 bytes of external data memory OR as the high bytes of the address bus for designs with external code memory.

Port

Dual purpose port on pins10-17. These pins are multifunctional. Each having an alternate purpose related to special features of 8051.

PSEN

(Program Store Enable)

8051 has four dedicated bus control signals. PSEN is an output signal on port 29.it is a control signal that enables expternal program(code) memory. It usually connect to EPROMs output Enable pin to permit reading of program bytes.

ALE

(Address Latch Enable)

Output signal on port 30,8051 used ALE for demultiplexing the address and data bus. Use to operate the Port 0 in alternate mode.

EA

(External Access)

EA input signal on pin 31 is generally tied high (+5) or low(ground). Executes program from internal ROM when executing in lower 4K/8K of memory. If the EA tied lower on 8051/8052 , internal ROM is disabled and program from external EPROM.

RST

(reset)

The RST input on port 9 is the master reset of 8051. Internal register are used to load appropriate value for system start up.

On-chip

Oscillator inputs

8051 feature an on chip oscillator that is typically driven by a crystal connected to pins 18 and 19.

Power

Connections.

8051 operates from a single +5 volt supply. The Vcc connection is on pin 40. Vss(ground) on pin 20.

There

are several possible addressing modes. Addressing modes are integral part of each computers instruction set.

Register Direct Indirect Immediate Absolute Long Indexed

Register

Addressing

8051 have eight working registers. Four banks of working register. Only one activated at a time.

ADD A,R7 Instructions using register addressing are encoded

Direct

Addressing Indirect Addressing

timer is a series of divide-by-2 flip flops that receive an input signal as a clock source. The clock is applied to first flip-flop, which divided the frequency by 2. Output of first flip-flop is clocks to second flip-flop, which is also divided by 2, and so on. Timer are use to generate an interrupt. If there is 16-bit timer then the input clock pulse is divided by 2^16=65536.

Timer

are accessed using sex special function register which are.


Timer mode register

TMOD contains two group of 4-bits that operation mode for timer _ timer is not bit-addressable, it loads once by software at the beginning of a program initialization the timer.

Timer control register


The TCON register contains status and control bit. Upper four bit of TCON used to turn timer on and off or signal timer overflow. The lower four bits only for generation of external interrupts.

Timer mode and overflow flag


13 Bit timer mode Clocking Sources

Interval Timing Event Counting

Initializing and Accessing timer Registers.

Introduction

8051 include on-chip serial port that can operate in several modes over a wide range of frequency. Serial port essential operation is parallel to serial conversion for output data and vice versa for input. Accessed through RXD (port 3.1 on pin 11) and TXD (P 3.0 on pin 10) pins and these pins are also alternate functional. Feature full duplex operation and receiver buffering . Serial port software provide accessed using to special function register SCON and SBUR. Serial port frequency of operation, or Baud rate, can be fixed (derived from on chip oscillator or variable(if baud rate is used timer1 supplies the baud rate clock and must be programmed accordingly.

There are two special function registers.

Serial port buffer register (SBUF) SBUF at address 99H is really two registers. Writing to SBUF load data to be transmitted(write only register), and SBUF accesses receive(read only register) data. Notice in figure that a serial-to-parallel shift register clock in the before it is transferred to the receive read-only register. The shift register is key element providing receive buffering. Only when all 8 bit of incoming data are received will they be transferred to the receive read-only register. While the are being received previous data are still intact in the receive read-only registers.

Serial port buffer register

SCON at address 98H is a bit addressable register containing status bit and control bits Status bit indicates the end of a character transmission or reception and are tested in software or program to cause an interrupt. Meanwhile, writing to the control bits would set the operating mode for the 8051serial port. Before using the serial port, SCON is initialized for the correct mode, and so on. For an example instruction is MOV SCON,#01010010B Initialize the serial port mode 1 (SM0/SM1 = 0/1) , enable the receiver(REN = 1), and sets the transmit interrupt flag(T1=1) to indicate the transmitter is ready for operation.

Potrebbero piacerti anche