Senin, 28 Maret 2011

A microcontroller (MCU) is a small computer in a single integrated circuit consisting of a CPU is relatively simple combined with support functions su

A microcontroller (MCU) is a small computer in a single integrated circuit consisting of a CPU is relatively simple combined with support functions such as crystal oscillators, timers, sensors, serial and analog I / O etc.
Program in the form of NOR flash memory or ROM OTP also often included on the chip, and, usually small, the R / W memory.
Microcontroller designed for small applications. Thus, in contrast to microprocessors used in personal computers and high performance applications, simplicity is emphasized.
Some microcontrollers can operate at clock frequencies as low as 32KHz, because it sufficient for some applications, and enables low power consumption (miliwatt or microwatts).
Microcontroller has the ability to maintain function while waiting for an interrupt; power consumption when idle (CPU clock and peripherals most off) may only nanowatts, so much of a microcontroller suitable for certain applications with battery / power supply that is more durable.
Microcontroller is used for the production of devices with the performance of automatic and controlled according to the function and logic, such as automobile engine control systems, remote controls, office machines, equipment, electrical equipment, and toys. By reducing the dimensions and size of the device then the costs can be reduced compared with a design that uses a separate microprocessor, memory, and input / output devices, microcontroller makes the process of making a digital devices become more economical.

Microcontroller AT89S51 type is MCS-51 microcontroller family with the exact same configuration with a fairly famous AT89C51, AT89S51 has a feature only ISP (In-System Programmable Flash Memory). This feature allows the microcontroller can be programmed directly in an electronic system without going through the Board or Downloader Programmer Board. Microcontroller can be programmed directly through a cable ISP that is connected to the parallel port on a Personal Computer.
The features of the microcontroller AT89S51 is as follows:

1. A CPU (Central Processing Unit) 8 bits which include MCS51 family.
2. Internal oscillator and timing circuit, 128 bytes of internal RAM (on chip).
3. Four programmable I / O ports, each consisting of an 8-lane I / O
4. Two 16-bit Timer Counter.
5. Five of the interrupt lines (2 and 3 external interrupt internal interruptions)
6. A serial port with full duplex UART serial control.
7. The ability to execute multiplication, division and Boolean operations (bit)
8. The speed of execution of instructions per cycle 1 microseconds at 12 MHz clock frequency
9. 4 Kbytes Flash ROM that can be charged and removed up to 1000 times
10. In-System Programmable Flash Memory

With the above features, making use AT89S51 devices become more simple and does not require a lot of support ICs. So the microcontroller AT89S51 has a privilege in terms of hardware. The block diagram of the microcontroller 89S51.
Block diagram of the microcontroller 89S51
AT89S51 Microcontroller Pin Configuration
The composition of pin microcontroller AT89S51
Pin Configuration AT89S51
Microcontroller AT89S51 has a pin numbered 40 and is generally packaged in a DIP (Dual Inline Package). Each pin on the microcontroller AT89S51 has a purpose as follows:
Port 0
Port 0 is port two functions that are on pins 32-39 of the AT89S51. In a simple system design this port as the port I / O versatile. For a more complex design involving an external memory of this track dimultiplek to the data bus and address bus.
Port 1
Port 1 is reserved as I / O ports and are on pins 1-8. Some of the pins on this port has a specific function of P1.5 (motion), P1.6 (MISO), P1.7 (SCK) is used to track download the program.
Port 2
Port 2 (pins 21-28) are two functions of the port as I / O versatile, or as high byte address bus for external memory involving design.
Port 3
Port 3 is a port of the two functions that are on pins 10-17, the port has multiple functions, such as those found in table 1.1 below:

Alternate ADDRESS BIT NAME BIT FUNCTION
B0h P3.0 RXD Receive data for serial port
B1h P3.1 TXD Transmit data for serial port
P3.2 INT0 External interrupt 0 B2h
P3.3 INT1 External interrupt 1 B3h
B4h P3.4 T0 Timer / counter 0 external input
B5h P3.5 T1 Timer / counter 1 external input
P3.6 WR B6h External data memory write strobe
P3.7 RD B7h External data memory read strobe

PSEN (Program Store Enable)

is an output signal is found on pin 29. Its function is as a control signal to allow the microcontroller to read the program (code) from external memory. Normally this pin is connected to pin EPROM. If the execution of the program from the internal ROM or from flash memory (Atmel AT89SXX), it is in the inactive state (high).

ALE (Address Latch Enable)
ALE output signal on pin 30 which is the same function with ALE on microprocessor INTEL 8085, 8088 or 8086. Demultiplek ALE signal is used for bus address and data bus. ALE signals generate pulses of 1 / 6 the oscillator frequency and can be used as a clock that can be used in general.

EA (External Access)
There is signal input on pin 31 which can be logic low (ground) or logic high (+5 V). If given the logic high then the microcontroller will access the program from an internal ROM (EPROM / flash memory). If given a logic low, the microcontroller will access the program from external memory.

RST (Reset)
Input reset on pin 9 is the master reset for AT89S51. Pulse transition from high to low for 2 cycles will reset the microcontroller.

Oscillator
Provided on-chip oscillator driven by XTAL is connected to pin 18 and pin 19. Necessary stabilizing capacitor of 30 pF. Great XTAL value of about 3 MHz to 33 MHz. XTAL1 is the input to the reversal of the oscillator amplifier (inverting oscillator amplifier) ​​and an internal clock input to the operation of the circuit. While XTAL2 is the output of oscillator amplifier reversal.

XTAL Oscillator Configuration
Power
AT89S51 operated at supply voltage of +5 v, pin Vcc is at number 40 and VSS (ground) on pin 20.

Memory Organization
a. Separation of Program and Data Memory
All 8051 devices have separate address spaces for program memory and data memory, as shown in gambar1.1. and figure 1.2. The logical separation of program memory and data memory allows data to be accessed by 8 bits, which can be quickly stored and manipulated with an 8-bit CPU. In addition, 16-bit data memory addresses can also be raised through the DPTR register. Program memory (ROM, EPROM) can only be read, not written. Program memory can reach up to 64K bytes. At 89S51, 4K bytes of program memory is contained within the chip. To read external program memory of microcontroller sends a signal PSEN (program store enable). Data Memory (RAM) occupies a separate address space from Program Memory. In the 8051 family, the lowest 128 bytes of data memory are on-chip. External RAM (up to 64K bytes). In accessing the external RAM, microcontroller send RD signal (read) and WR (write).

MCS51 memory structure

8051 Microcontroller Architecture Memory
b. Memory Program
shows a map of the lower part of the program memory. After reset, the CPU begins execution from location 0000H. As shown in Figure 1.6, each interrupt is assigned a fixed location in program memory. Interrupt causes the CPU to jump to the location where to do a particular service. External Interrupt 0, for example, is assigned to location 0003H. If External Interrupt 0 is used, its service routine must begin at location 0003H. If the interruption is not used, the location service can be used for various purposes as the Memory Program.

Interrupt Map 8051 microcontroller
c. Data Memory
In the figure below shows the memory space of internal and external data on the 8051 family. CPU generates RD and WR signals as needed during external RAM accesses. internal data memory under the memory ram divided into three blocks, which is referred as the lower 128 bytes, 128 bytes of upper and SFR space. Internal data memory address always has a width of one byte of data. Directly addressing the above 7Fh will access a memory address, and indirect addressing above 7Fh will access a different address. Thus in the figure below shows the 128 bytes of the top and SFR space occupying the same address block, ie 80h to FFH, which they actually physically separated
The lower 128 bytes of RAM are grouped into several blocks, 32 bytes of RAM at the bottom, grouped into 4 banks, each consisting of 8 registers. Program instructions call out these registers as R0 through R7. Two bits in the Program Status Word (PSW) select which register bank is to be used. The use of registers R0 through R7 will make programming more efficient and shorter, when compared directly addressing.


Memori data internal


128 bytes of internal RAM under


All the locations under 128 bytes of RAM can be accessed either by using direct and indirect addressing. Top 128 bytes can be accessed only by indirect.

128 bytes of internal RAM for
d. Special Function Registers
A memory map is called a space special function register (SFR) is shown in the following figure. Note that not all addresses are occupied, and the addresses are not occupied are not allowed to be implemented. Read access to this address will generate random data, and write access will result in no apparent effect.

e. Accumulator
ACC is the accumulator register. Mnemonics for accumulator-specific instructions this can simply be abbreviated as A.

f. Register
Register B is used at the time opersi multiplication and division. In addition to the above purpose, this register can be used to register free.

g. Program Status Word.
PSW registers consist of information on the status of the program.

h. Stack Pointer
Pointer register stack has a width of 8 bits of data. This register will increase before the data is stored during the execution of the push and call. While the stack may be a place of RAM. Stack pointer starts at address 07h after a reset. This causes the stack to begin at location 08h.

i. Data Pointer
Data Pointer (DPTR) consists of a byte over (DPH) and lower byte (DPL). This function is intended to store data 16 bits. Can be manipulated as a 16-bit register or two 8-bit registers that stands alone.
Mapping Data Pointer

Tidak ada komentar:

Posting Komentar