Professional Documents
Culture Documents
Syllabus
Module 2
Embedded C compiler advantages memory models interrupt functions code optimization - 89C2051 micro-controllerarchitecture-comparison with 89C51- design of a simple trainer circuit using 89C51/89C2051 C interfacing of DIP switch, LED, 7 segment display, alphanumeric LCD relay interface design of a traffic light control system - interfacing programs using C and assembly language.
89C51
FEATURES
8 bit CPU with registers A and B 16 bit PC and DPTR 8 bit PSW 8 bit stack pointer Internal ROM 4K Internal RAM of 128b Oscillator & clock circuits
Prepared by Emil Raj,Dept. Of ECE,MLMCE
Four 8 bit ports:P0-P3 Two 16 bit timers & counters:T0&T1 Full duplex serial data Rxr/Txr : SBUF. Control registers : TCON,TMOD, SCON,PCON,IP &IE 2 external & 3 internal interrupts.
INTERNAL RAM
Total 128 Bytes. Divided into 3 groups. 4 Register banks. Bit addressable memory(16 bytes). General purpose registers(80 bytes).
Prepared by Emil Raj,Dept. Of ECE,MLMCE
INTERNAL RAM
Each bank has 8 registers(R0-R7). RS0 & RS1 bits selects the bank.
BANK 0: 00-07H BANK 1: 08-0FH BANK 2: 10-17H BANK 3:18-1FH
BIT ADDRESSABLE
16 bytes from20H to 2FH. Total 128 bits. Specified by its bit address of 00H to 7FH. Set directly by SETB 2F. Cleared by CLR 2F.
89C2051
PIN DIAGRAM
89C51 89C2051
89C2051 FEATURES
2K bytes of Flash 128 bytes of RAM 15 I/O lines two 16-bit timer/counters full duplex serial port a precision analog comparator on-chip oscillator and clock circuitry compatible with the industry standard MCS51 instruction set. supports two software selectable power saving modes.
Idle Mode
Prepared by Emil Raj,Dept. Power down mode Of ECE,MLMCE
89C2051 FEATURES
Idle Mode
Stops the CPU while allowing the RAM, timer/counters, serial port and interrupt
89C2051 FEATURES
Consist of Program Memory Lock Bits
There are two on-chip lock bits which can be left un programmed (U) or can be programmed (P). They provide a kind of security for the data. The Lock Bits can only be erased with the Chip Erase operation. Prepared by Emil Raj,Dept. Of ECE,MLMCE
7 SEGMENT DISPLAY
PIN CONNECTIONS
INTERFACING
INTERFACING
PROGRAM
ORG 0000h CLR P0.1 CLR P0.2 MOV P2, #ffh Loop: CLR P0.2 SETB P0.1 MOV P2, # B0h CALL delay CLR P0.1 SETB P0.2 MOV P2, # 0F9h CALL delay AJMP loop
Prepared by Emil Raj,Dept. Of ECE,MLMCE
INTERFACING PRGM
RELAY
Electromechanical switch, which perform ON and OFF operations without any human interaction. The relay consists a inductor coil, a spring (not shown in the figure), Swing terminal, and two high power contacts named as normally closed (NC) and normally opened (NO). Relay uses an Electromagnet to move swing terminal between two contacts (NO and NC). When there is no power applied to the inductor coil (Relay is OFF), the spring holds the swing terminal is attached to NC contact.
Prepared by Emil Raj,Dept. Of ECE,MLMCE
RELAY
Whenever required power is applied to the inductor coil, the current flowing through the coil generates a magnetic field which moves the swing terminal to normally open (NO) contact. When power is OFF, the spring restores the swing terminal position to NC.
TYPES OF RELAY
Relay Interfacing
.