A Microcontroller is a single-chip microcomputer that contains all the components such as the CPU, RAM, some form of ROM, I/O ports, and timers. Unlike a generalpurpose computer, which also includes all of these components, a microcontroller is designed for a very specific task -- to control a particular system. Microcontrollers are sometimes called embedded microcontrollers, which just means that they are part of an embedded system. A microprocessor is a general-purpose digital computer with central processing unit (CPU), which contains arithmetic and logic unit (ALU), a program counter (PC), a stack pointer (SP), some working registers, a clock timing circuit, and interrupts circuits. The main disadvantage of microprocessor is that it has no on-chip memory. So we are going for micro controller since it has on-board programmable ROM and I/O that can be programmed for various control functions AT89S52 MICROCONTROLLER The microcontroller development effort resulted in the 8051 architecture, which was first introduced in 1980 and has gone on to be arguably the most popular micro controller architecture available. The 8051 is a very complete micro controller with a large amount of built in control store (ROM & EPROM) and RAM, enhanced I/O ports, and the ability to access external memory. The maximum clock frequency with an 8051 micro controller can execute instructions is 20MHZ. Microcontroller is a true computer on chip. The design incorporates all of the features found in a microprocessor: CPU, ALU, PC, SP and registers. It also has the other features needed to, make complete computer: ROM, RAM, parallel I/O, serial I/O, counters and a clock circuit. The 89C51/89C52/89C54/89C58 contains a non-volatile FLASH program memory that is parallel programmable. For devices that are serial programmable (In-System Programmable (ISP) and In-Application Programmable (IAP) with a boot loader)All three families are Single-Chip 8-bit Microcontrollers manufactured in advanced CMOS process and are Derivatives of the 80C51 microcontroller family. All the devices have the same instruction set as the 80C51. 2.3 FEATURES • 8K Bytes of In-System Reprogrammable Flash Memory • Endurance: 1,000 Write/Erase Cycles • Fully Static Operation: 0 Hz to 33 MHz • Three-level Program Memory Lock • 256 x 8-bit Internal RAM • 32 Programmable I/O Lines • Three 16-bit Timer/Counters • Eight Interrupt Sources • Programmable Serial Channel • Low-power Idle and Power-down Modes 2.4 DESCRIPTION: The AT89s52 is a low power, high performance CMOS 8-bit micro computer with 8K bytes of flash programmable and erasable read only memory(PEROM).The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard 80c51 and 80C52 instruction set and pin out. The on-chip flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU
with flash on a monolithic chip, the Atmel AT89s52 Is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The main advantages of 89s52 over 8051 are Software Compatibility Program Compatibility Rewritability The 89s52 microcontroller has an excellent software compatability, i.e. the software used can be applicable to any other microcontroller. The program written on this microcontroller can be carried to any base. Program compatibility is the major advantage in 89s52. The program can be used in any other advanced microcontroler. The program can be reloaded and changed for nearly 1000 times. 2.4.1 89s52 PROCESSOR ARCHITECTURE:
The AT89s52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset.
2.4.3 PIN DESCRIPTION: VCC Supply voltage. GND Ground. Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed lower order address/data bus during accesses to external program and data memory. In this mode, P0 has internalpullups.Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pullups are required during program verification. Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2