Microcontroller AT89S52
pin layout 80C5 .
Microcontroller AT89S52 has:
• A CPU (Central Processing Unit) 8 Bit.
• 256 bytes of RAM (Random Access Memory) internally.
• Four I / O ports, which each consist of 8 bits
• the internal oscillator and timer circuit.
• Two timer / counters 16 bits
• Five interrupt lines (2 and 3 external interrupt internal interruptions).
• A serial port with full duplex UART (Universal Asynchronous Receiver Transmitter).
• Able to carry out the process of multiplication, division, and Boolean.
• the size of 8 KByte EPROM for program memory.
• Maximum speed execution of instructions per cycle is 0.5 μs at 24 MHz clock frequency. If the microcontroller clock frequency used is 12 MHz, the speed of execution of the instruction is 1 μs
CPU (Central Processing Unit)
This section serves to control the entire operation of the microcontroller. This unit is divided into two parts, the control unit, or CU (Control Unit) and the arithmetic and logic unit or ALU (arithmetic logic unit) The main function of the controlling unit is to take instructions from memory (fetch) and then translate these instructions into a collection arrangement of simple labor process (decode), and perform a sequence of instructions in accordance with the steps that have been determined the program (execute). Arithmetic and logic unit is the part that deals with arithmetic operations like addition, subtraction, and logical data manipulation operations such as AND, OR, and comparisons.
Section Input / Output (I / O)
This section serves as a communication tool with a single chip device is outside the system. As the name implies, the device I / O may receive or provide data from / into a single chip.
There are two kinds of devices I / O is used, namely the tools to link serial UART (Universal Asynchronous Receiver Transmitter) and tools for parallel connection called PIO (parallel Input Output). Both types of I / O has been available in a single chip AT89S52.
Software
Single chip MCS-51 family has a special programming language that is not understood by the single chip type to another. This programming language known as assembly language instructions that have 256 devices. However, the current microcontroller programming can be done using C language With the C language, microcontroller programming easier, it is because the C language format will be automatically converted into assembler language with hex file format. The software on the microcontroller can be divided into five groups as follows:
1. Data Transfer Instructions
This instruction serves to transfer data, namely between registers, from memory to memory, from registers to memory and others.
2. Arithmetic Instruction
These instructions perform arithmetic operations including addition, subtraction, addition of one (increment), the reduction of one (decrement), multiplication and division.
3. Logic and Bit Manipulation Instructions
Function to perform logic operations AND, OR, XOR, comparison, shift and complement data.
4. Branching Instructions
Serves to change the normal order of execution of a program. With this instruction, the programs that are implemented will jump to a specific address.
5. Instruction Stack, I / O, and Control
These instructions govern the use of the stack, read / write I / O ports, and control.
Pin Configuration
Microcontroller AT89S52 has a 40 pin with a single 5 Volt power supply. To-40 pin is described as follows:
The function of each pin AT89S52 is:
1. Pin 1 to 8 (Port 1) is an 8-bit parallel port of a two-way (bidirectional) that can be used for various purposes (general purpose).
2. Pin 9 is a reset pin, active reset if you get a high ration.
3. Pin 10 to 17 (Port 3) is 8-bit parallel port which has a two-way alternate function as follows:
• P3.0 (10): RXD (serial port data receiver)
• P3.1 (11): TXD (serial port is sending data)
• P3.2 (12): INT0 (external interrupt inputs 0, active low)
• P3.3 (13): INT1 (ekstrernal interrupt input 1, active low)
• P3.4 (14): T0 (external input timer / counter 0)
• P3.5 (15): T1 (external input timer / counter 1)
• P3.6 (16): WR (Write, active low) signal controls the writing of data from port 0 to memory and input-output data externally.
• P3.7 (17): RD (Read, active low) signals control the memory reading an external input-output data to port 0.
4. Pin 18 as XTAL 2, the output that is connected to the crystal oscillator.
5. Pin 19 as XTAL 1, the input to the oscillator berpenguatan high, connected to the crystal.
6. Pin 20 as VSS, is connected to 0 or ground on the circuit.
7. Pin 21 to 28 (Port 2) is 8-bit parallel port bidirectional. This port sends the address byte when accessing conducted in external memory.
8. Pin 29 as the PSEN (Program Store Enable) is the signal used to read, moving the external program memory (ROM / EPROM) to microcontroller (active low).
9. Pin 30 as ALE (Address Latch Enable) to hold down the address for accessing external memory. This pin also functions as a PROG (active low) that is activated when the internal program flash memory on the microcontroller (on chip).
10. Pin 31 as the EA (External Accesss) to select the memory to be used, the internal program memory (EA = Vcc) or an external program memory (EA = VSS), also serves as Vpp (programming supply voltage) when programming the internal flash memory on the microcontroller .
11. Pin 32 to 39 (Port 0) is an 8 bit parallel port is bidirectional. Functioning as an address under which dimultipleks with data for accessing external program and data memory.
12. Pin 40 as Vcc, is connected to +5 V as a ration for the microcontroller.
Organization of Memory
All single chip in MCS-51 family has a division of address space to programs and data. The separation of program memory and data memory allows data to be accessed by the memory address 8 bits. Even so, the address memory 16 bits of data can be generated through the DPTR register (Point Data Register). Program memory can only be read can not be written because it is stored in the EPROM. In this case the EPROM is available in single chip AT89S52 of 8 Kbyte
a. Memory Program
At 8 Kbyte EPROM, if EA (External Access) high-value, then the program will occupy a 0000 address to 0FFF H H internally. If EA is low value then the program will occupy the address 1000 H to FFFF H to external programs.
b. Data Memory
Internal data memory is mapped as shown below memory space is divided into three blocks of the 128 down, 128 up, and space SFR (Special Function Register)
Under Section 128 bytes of RAM mapped into 32 bytes below are grouped into 4 banks and 8 registers (R0 to R7). In the next 16 bytes, on top of the register banks, form a block of memory space that can teralamati per bit (bit addressable). Addresses are 00 bits up to 7F H. H All bytes that are in 128 below can be accessed either directly or indirectly. Section 128 can only be accessed by indirect addressing. Section 128 of the RAM is only in the devices have 256 bytes of RAM.