BASIC CIRCUIT FOR 8051 / 89S52 :
8051 PIN OUT
l Power - Vcc, Vss
l Reset - RST
l Crystal - XTAL[1,2]
l External device interfacing
– EA, ALE, PSEN, WR, RD
l I/O Port
– P0[7;0], P1[7:0], P2[7:0], P3
P3 is shared with control lines
– Serial I/O RxD, TxD,
– external interrupts INT0, INT1
– Counter control T0, T1
P0 and P2 are multiplexed with Address and Data bus
BASIC CIRCUIT -THAT MAKES 8051 WORKS.
EA/VP Pin
The EA on pin 31 is tied high to make the 8051 executes program from Internal ROM
Reset Circuit
RESET is an active High input When RESET is set to High, 8051 goes back to the power on state.
The 8051 is reset by holding the RST high for at least two machine cycles and then returning it low.
Power-On Reset
- Initially charging of capacitor makes RST High
- When capacitor charges fully it blocks DC.
Manual reset
-closing the switch momentarily will make RST High.
After a reset, the program counter is loaded with 0000H but the content of on-chip RAM is not affected.
Register | Content | Register | Content |
Program counter | 0000h | IP | XXX00000b |
Accumulator | 00h | IEv | 0XX00000b |
B register | 00h | All timer registers | 00h |
PSW | 00h | SCON | 00h |
SP | 07h | SBUF | 00h |
DPTR | 0000h | PCON (HMOS) | 0XXXXXXXbv |
All ports | FFh | PCON (CMOS)v | 0XXX0000b |
Note: content of on-chip RAM is not affected by Reset.
Oscillator Circuit
The 8051 uses the crystal for precisely that: to synchronize it’s operation. Effectively, the 8051 operates using what are called "machine cycles." A single machine cycle is the minimum amount of time in which a single 8051 instruction can be executed. although many instructions take multiple cycles.
8051 has an on-chip oscillator. It needs an external crystal thats decides the operating frequency of the 8051.
This can be achieved in two ways,,
The crystal is connected to pins 18 and 19 with stabilizing capacitors. 12 MHz(11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF.
The oscillator can also be a TTL clock source connected with a NOT gate asshown
How fast 8051 works ?
A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the crystal is pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we can calculate how many instruction cycles the 8051 can execute per second:
11,059,000 / 12 = 921,583
Why crystal frequency?
11.0592 MHz crystals are often used because it can be divided to give you exact clock rates for most of the common baud rates for the UART, especially for the higher speeds (9600, 19200). Despite the "oddball" value, these crystals are readily available and commonly used.
Power Supply
The 78L05 is a 5V regulator. The input voltage ranges from 7V to 35V and the output voltage is about 5V.