Skip to main content

Pin Description of 8051

The 8051 packaged in a 40-pin DIP. The figure shows the pin diagram of 8051. Many of the pins of 8051 are used for more than one function. The alternative functions are also shown in the diagram.
The 8051 has 32 I/O pins configured as four eight-bit parallel ports(P0, P1, P2 and P3). All four ports are bidirectional i.e., each pins will be configured as input or output(or both). All port-pins are multiplexed except pins of port 1. Each ports consist of a latch, an output driver and an input buffer.

Port 0(Pins 32-39): Port 0 pins are used as I/O pins. The output drives and input buffer of port 0 are used to access external memory address, time multiplexed with the data being written or read. Thus, port 0 can be used as a multiplexed address{/data bus.
Port 1(Pins 1-8): Port 1 pins can used only as I/O pins
Port 2(Pins 21-28): The output drives of port 2are used to access external memory. Port 2 outputs are high order byte of the external memory address when the address is 16-bit wide. Otherwise, port 2 is used as an I/O port.
Port 3(Pins 10-17): All port pins of port 3 are multifunctional. Therefore, each pins of port 3 can be programmed to use as I/O or as one of the alternative functions. They have special functions bas shown in table below, including two external interrupts, two special data lines and two timing control strobes.
Symbol Position Alternate use
RD' P3.7 External memory read signal
WR' P3.6 External memory write signal
T1 P3.5 External timer 1 input
T0 P3.4 External timer 0 input
INT1' P3.3 External interrupt 1 input
INT0' P3.2 External interrupt 0 input
TXD P3.1 Serial data output
RXD P3.0 Serial data input
Power-supply Pins Vcc(Pin 40) and Pin Vss(Pin 20): 8051 operates on D.C power supply 0f +5V with respect to ground. The +5V is to be connected to pin Vcc and ground to pin Vss with rated power supply current of 125mA.
Oscillator Pins XTAL2(Pin 18) and XTAL1(Pin 19): For generating an internal clock signal, the external Oscillator is connected at these two pins. Usually Quartz crystal is connected to these pins as shown in the following diagram. Capacitance within the oscillator mechanism are not critical and are normally about 30pF. These are used for providing stable oscillations. Instead of a Quartz crystal, miniature ceramic resonators can also be used. In that case, it is recommended to use higher capacitance(about 47pF). New microcontrollers works at frequencies ranging from 0Hz to 50MHz.

ALE(Address Latch Enable, Pin 30): AD0 to AD7lines are multiplexed. To demultiplex these lines and obtaining lower half of an address, an external latch and ALE signal of 8051 is used.
RST(Reset, Pin 9): This pin is used to reset 8051. For proper reset operation, reset signal must held high atleast for two machine cycles, while oscillator is running. This high logical state on this input halts the microcontroller and clears all the registers. Bringing this pin back to logical state zero starts the program as if the power had just been turned on. Depending on the device's purpose and Environments, this pin is usually connected to the push button, reset-upon-start circuit or brown out reset circuit. The image shows one simple circuit for safe reset upon starting the controller.

PSEN'(Program Store Enable, Pin 29): It is the active low output control signal used to activate the enable signal of the external ROM/EPROM. It is activated every six oscillator periods while reading the external memory. Thus, this signal acts as the read strobe to external program memory.
EA'(External Access, Pin 31): When EA' is high (connected to Vcc), program fetches to addresses 0000H through 0FFFH are directed to the internal ROM and program fetches to addresses 1000H through FFFFH are directed to external ROM/EPROM. When EA'is low(grounded), all addresses(0000H to FFFFH) fetched by program are directed to the external ROM/EPROM.

Comments

Popular posts from this blog

8051 Simple Programs

Sum of 8-bit Numbers Stored in Memory Here  we will discuss about 8051 programs but we can't discuss about all of the 8051 instructions. For programming 8051 we should know about assembler directives as well as instruction set. Click  here to download Atmel c51 user guide that will discuss about 8051(c51 family microcontroller) instruction set, assembler directives, c51 cross assembler from Atmel.  Program ORG 00H MOV R0,#50H   ; get memory location in memory pointer R0 MOV R1,#51H   ; get memory location on memory pointer register R1 MOV A,@R0       ; get content of memory location 50H to accumulator ADD A,@R1        ; add content of A with content of memory location 51H and store result in A MOV R0,#52H    ; get 52H to memory pointer R0 MOV@R0,A         ; copy content of A to memory location 52H END Add 16-bit Numbers ...

Introduction to 8051 embedded C

For 8051 we need to include the file reg51.h. This file contains the all the definitions of 8051 registers. With this information C compiler produces hex file that can be downloaded into the ROM of the microcontroller. It is important to note that the size of the hex file produced by the assembly language is much larger than the hex file produced by C compiler. Apart from this fact, there is many reasons for writing programs in C instead of assembly: ●It is much easier and less time consuming to write programs in C assembly. ●C is more flexible; it is easier to modify and update. ●Programming in C allows to use code available in function libraries. ●Program written inC for one microcontroller is portable to other microcontrollers with little or no modifications. Data Types in 8051 Embedded C The table shown below lists the data types that are available in typical C51 compiler. The gives information about the size of the data variable and it's value range. Data type ...

Frequency of Oscillation of RC Phase Shift Oscillator

Derivation of Frequency of Oscillation We have to find out the transfer function of RC feedback network. Feedback Circuit of RC Phase Shift Oscillator Applying KVL to various loops on the figure, we get, $$I_1 \left(R+\frac{1}{j \omega C }\right) -I_2R=V_i \text{ ....(1)}$$ $$-I_1R+I_2\left (2R+\frac {1}{j\omega C}\right)-I_3R=0\text{ ... (2)}$$ $$0-I_2R+I_3\left(2R+ \frac{1}{j\omega C}\right)=0\text{ ...(3)}$$ Replacing \(j\omega\) with \(s\) and writing equations in the matrix form, $$\begin{bmatrix}R+\frac{1}{sC} & -R & 0 \\-R & 2R+\frac{1}{sC} & -R \\0 & -R & 2R+\frac{1}{2sC} \end{bmatrix}\begin{bmatrix}I_1\\I_2\\I_3\end{bmatrix}=\begin{bmatrix}V_i\\0\\0\end{bmatrix}$$ Using Cramer's rule to find out \(I_3\), $$\text{Let, }D=\begin{bmatrix}R+\frac{1}{sC} & -R & 0 \\-R & 2R+\frac{1}{sC} & -R \\0 & -R & 2R+\frac{1}{2sC} \end{bmatrix}$$ \(|D|=\begin{vmatrix}R+\frac{1}{sC} & -R & 0 \\-R & 2R+\frac{1}{...