AT89C51 Microcontroller
Pin Description
Pin Number |
Pin Name |
Description |
1 |
P1.0 |
0th pin of PORT P1 |
2 |
P1.1 |
1st pin of PORT P1 |
3 |
P1.2 |
2nd pin of PORT P1 |
4 |
P1.3 |
3rd pin of PORT P1 |
5 |
P1.4 |
4th pin of PORT P1 |
6 |
P1.5 |
5th pin of PORT P1 |
7 |
P1.6 |
6th pin of PORT P1 |
8 |
P1.7 |
7th pin of PORT P1 |
9 |
RST |
Reset pin of the Microcontroller |
10 |
(RXD) P3.0 |
0th pin of PORT P3 or Receiver pin of Microcontroller |
11 |
(TXD) P3.1 |
1st pin of PORT P3 or Transmitter pin of Microcontroller |
12 |
(INT0) P3.2 |
2nd pin of PORT P3 or External Interrupt 0 of MCU |
13 |
(INT1) P3.3 |
3rd pin of PORT P3 or External Interrupt 1 of MCU |
14 |
(T0) P3.4 |
4th pin of PORT P3 or Timer 0 interrupt of MCU |
15 |
(T1) P3.5 |
5th pin of PORT P3 or Timer 1 interrupt of MCU |
16 |
(WR) P3.6 |
6th pin of PORT P3 or Write to External data memory pin |
17 |
(RD) P3.7 |
7th pin of PORT P3 or Read from External data memory pin |
18 |
XTAL2 |
External crystal pin 2 of Microcontroller |
19 |
XTAL1 |
External crystal pin 1 of Microcontroller |
20 |
GND |
Ground pin of MCU |
21 |
P2.0(A8) |
0th pin of PORT P2 or High-order Address bit 8 of MCU |
22 |
P2.1(A9) |
1st pin of PORT P2 or High-order Address bit 9 of MCU |
23 |
P2.2(A10) |
2nd pin of PORT P2 or High-order Address bit 10 of MCU |
24 |
P2.3(A11) |
3rd pin of PORT P2 or High-order Address bit 11 of MCU |
25 |
P2.4(A12) |
4th pin of PORT P2 or High-order Address bit 12 of MCU |
26 |
P2.5(A13) |
5th pin of PORT P2 or High-order Address bit 13 of MCU |
27 |
P2.6(A14) |
6th pin of PORT P2 or High-order Address bit 14 of MCU |
28 |
P2.7(A15) |
7th pin of PORT P2 or High-order Address bit 15 of MCU |
29 |
PSEN |
Program store enable pin, Read external program memory |
30 |
ALE/PROG |
Address Latch Enable/ Program Pulse input for flashing |
31 |
EA/VPP |
Access Enable voltage/Program enable voltage |
32 |
P0.7(AD7) |
7th pin of PORT P0 or Low-order Address bit 7 of MCU |
33 |
P0.6(AD6) |
6th pin of PORT P0 or Low -order Address bit 6 of MCU |
34 |
P0.5(AD5) |
6th pin of PORT P0 or Low -order Address bit 5 of MCU |
35 |
P0.4(AD4) |
6th pin of PORT P0 or Low -order Address bit 4 of MCU |
36 |
P0.3(AD3) |
3rd pin of PORT P0 or Low -order Address bit 3 of MCU |
37 |
P0.2(AD2) |
2nd pin of PORT P0 or Low -order Address bit 2 of MCU |
38 |
P0.1(AD1) |
1st pin of PORT P0 or Low -order Address bit 1 of MCU |
39 |
P0.0(AD0) |
0th pin of PORT P0 or Low -order Address bit 0 of MCU |
40 |
Vcc |
Supply pin of MCU |
Features
AT89C51 –Simplified Features |
|
CPU |
8-bit 8051 |
Number of Pins |
40 |
Operating Voltage (V) |
2 to 5.5 V |
Number of I/O pins |
32 |
ADC Module |
Nil |
Timer/Counter Module |
16-bit(2) |
Comparators |
Nil |
DAC Module |
Nil |
Communication Peripherals |
UART(1) |
External Oscillator |
3MHz to 24Mhz |
Internal Oscillator |
Yes |
Program Memory Type |
Flash |
Program Memory (KB) |
4K |
RAM Bytes |
128 × 8-bit |
Data EEPROM |
Nil |
Note: The AT89C51 datasheet of the Microcontroller and more detailed Features can be found at the bottom of this page.
Other ATMEL MCU’s
AT89S52, ATtiny45, ATMega328P, ATMega8, ATMEga32, ATtiny88
AT89C51 Microcontroller
The AT89C51 is an age old 8-bit microcontroller from the Atmel family. It works with the popular 8051 architecture and hence is used by most beginners till date. It is a 40 pin IC package with 4Kb flash memory. It has four ports and all together provide 32 Programmable GPIO pins. It does not have in-built ADC module and supports only USART communication. Although it can be interfaced with external ADC IC like the ADC084 or the ADC0808.
The AT89C51 is no longer in production and Atmel does not support new design. Instead the new AT89S51 is recommended for new applications. But, since the AT89C51 has a strong community support if your motive is to learn embedded then AT89C51 can still be a good choice.
How to Program the AT89C51 (8051) Microcontroller
Atmel microcontroller can be programmed with different software's that is available in the market. Arduino, Keil uVision are the most used platforms to name a few. If you are planning on serious programming and expansion with community support then Keil is recommended.
In order to program the Atmel microcontroller we will need an IDE (Integrated Development Environment), where the programming takes place. A compiler, where our program gets converted into MCU readable form called HEX files. An IPE (Integrated Programming Environment), which is used to dump our hex file into our MCUs.
IDE: Keil uVision IDE
Programming Hardware: MAX232 with RS232 to USB converter
Programmer: USBASP
To dump or upload our code into Atmel IC we need a programmer, the most commonly used programmer is the USBASP which has to be purchased separately. Also simulating you program on software before trying it on hardware will save a lot of time. So you can use software like ISIS proteus from Labcenter to simulate your programs.
A 8051 (AT89C51) Programming circuit is shown below
Detailed Features
AT89C51 – Detailed Features |
|
CPU |
8-bit 8051 family |
Architecture |
8051 |
Program Memory Size (Kbytes) |
4K Flash |
RAM (bytes) |
128 |
EEPROM/HEF |
Nil |
Pin Count |
40 |
Max. CPU Speed (MHz) |
24 |
Peripheral Pin select (PPS) |
No |
Internal Oscillator |
No |
No. Of comparators |
2 |
No. Of Operational Amplifier |
0 |
No. Of ADC channels |
Nil |
Max ADC Resolution (bits) |
NA |
ADC with Computation |
No |
Number of DAC Converter |
0 |
Max DAC resolution |
0 |
Internal Voltage Reference |
NA |
Zero Cross Detect |
No |
No. Of 8-bit timers |
0 |
No. Of 16-bit Timers |
2 |
Signal Measurement Timer |
0 |
Hardware Limit Timer |
0 |
No. Of PWM outputs |
0 |
Max PWM resolution |
NA |
Angular Timer |
No |
Math Accelerator |
No |
No. Of UART module |
1 |
No. Of SPI Module |
0 |
No. Of I2C module |
0 |
No. Of USB Module |
0 |
Windowed Watchdog Timer (WWDT) |
No |
CRC/Scan |
No |
Numerically Controlled Oscillator |
0 |
Cap. Touch Channels |
NA |
Segment LCD |
0 |
Minimum Operating Temperature (*C) |
-55 |
Maximum Operating Temperature (*C) |
125 |
Minimum Operating Voltage (V) |
4 |
Maximum Operating Voltage (V) |
5.5 |
High Voltage Capable |
No |
How to select your Atmel Microcontroller
Microchip provides a vast variety of Microcontrollers from PIC family and Atmel Family. Their collection has just piled up after Microchip has acquired Atmel. Each MCU has its own advantage and disadvantage. There are many parameters that one has to consider before selecting a MCU for his/her project. The below points are just suggestions which might help one to select a MCU.
- If you are a beginner who is learning Microcontroller then, selecting a MCU that has good online community support and wide applications will be a good choice. For Atmel AT89S52 or ATmega328 will be a good choice.
- Consider the operating voltage of your system. If they are 5V then select a 5V MCU some sensors or devices work and communicate on 3.3V in such case a 3.3V MCU can be selected
- If size and price is a limitation then you can choose small 8-pin MCUs like Attiny1614. These are also comparatively cheaper.
- Based on the sensors and actuators used in your project, verify which modules you might need in for MCU. For example is you are reading many Analog voltages then make sure MCU has enough ADC channels and supportive resolution. The details of all modules are given in the table above.
- If you project involves communication protocols like UART, SPI ,I2C, CAN etc make sure you MCU can support them. Some MCU can support more than one module of the same protocol
Applications
- Multiple DIY Projects
- Very good choice if you are learning ATmel
- Projects requiring Multiple I/O interfaces and communications
- Replacement for Arduino Module
- Ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications.
2D Model (PSDIP)