Posts

Showing posts with the label AT89C51

Basic Understanding of AT89C51

Image
1. Introduction The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash erasable and programmable read only memory (EPROM). It can be erased and program to a maximum of 1000 times. 2. Block Diagram (Resources) The chip has the following available resources: 3. Features The chip has the following features. 4K Bytes of In-System Re-programmable Flash Memory Fully Static Operation: 3 MHz to 24 MHz 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Five Interrupt Sources Programmable Full Duplex Serial Port Low-power Idle and Power-down Modes 4. Chip Grade and Packages The chip is available in commercial (0° C to 70° C)) and industrial (40° C to 85° C) grade with PDIP (40 pins), PQFP/TQFP (44 pins), and PLCC (44 pins) package. 5. Pin Designation 6. Pin Level Details 6.1. Power Supply Pins VCC Pin 40 provides supply voltage to the chip. The voltage source is +5v GND The pin 20 is...

Embedded-C Guideline for AT89C51 (I/O Programming)

Image
This article has complete embedded-C programming guideline for AT89C51 micro-controller. All examples are written in Keil uVision2 V2.30 and Proteus 8.0 SP 0 is used for simulation. Input and Output Programming The AT89C51 has four 8-bit ports and you can configure any port or individual pin as input or output by writing one (1) to make any port or pin as input and by writing zero (0) to make as output. This is required only at the time of initialization. Port-0 Initialization as Input The following function initialize the port-0 as input. void InitP ort0AsInput(void) { // write 1’s to initialize port-0 as input P0 = 0xFF; } Port-0 Initialization as Output The following function initialize the port-0 as output. void InitPort0AsOutput(void) { // write 0’s to initialize port-0 as output P0 = 0x00; } Port-0 Initialization as In/Out You can also configure individual pin as input or output. The following function initialize the port-0 pin P0.7, P0.6,P0.0...