Documente Academic
Documente Profesional
Documente Cultură
Microcontrollers
Syllabus
CP356: Microprocessors and Microcontrollers
CREDITS =6 (L=4, T=0, P=2)
• (Prerequisite: EL206 Digital Circuits)
1. Introduction to Microcontrollers : Intel 8051 architecture. Software
architecture. details of SFRs. Port structures. External memory
interface. Interrupt. Serial and Timer/counters facility. Instruction set
and programming of 8051.
2. Programmable I/O ports: Study of Intel 8255 in modes 0, 1 and 2.
Interface of A/D and D/A converters with microcontroller and related
Software.
3 Memory and device selection : Generation of chip select logic;
address decoding for memory and I/O ports; latching and buffering;
development of a small 8051 based microcomuter system.
4. Study of programmable peripheral controllers : Timer/counter
device Intel 8253; keyboard and display controller Intel 8279.
5. Serial communication : Synchronous and asynchronous
communication. Study of the Western Digital 8250
communication controller. Principle of operation of modems. The
EIA RS-232C serial interface standard.
6. Special purpose and 16 bit microcotrollers
7. Microcontroller applications : Interfacing of input/output devices,
keyboard, switches, seven segment dispaly, LCD display. Design of
microcontroller based systems for industrial applications,
Temperature scanner and weight measurement systems.
Embeded Systems, its hardware and software requirements.
REFERENCE BOOKS:
• 1. R.S. Gaonkar
Microprocessor Architecture, Programming and Applications with 8085A
Penram International
• 2. Muhammad Ali Mazidi
Janice Gillispie Mazidi
The 8051 Microcontroller and Embedded systems
Prentice Hall of India
• 3. Kenneth J. Ayala
The 8051 Microcontroller Architecture, Programming & Applications
Penram International
• 4. V Udayashankara & M S Mallikarjunaswamy
• 8051 Microcontroller Hardware, software and applications
CP356: Microprocessors and Microcontrollers
CREDITS =6 (L=4, T=0, P=2)
• List of Experiments:
• 1. Programs using arithmetic instructions of 8051
• 2. Programs using logical instructions of 8051
• 3. Programs using control and branch instructions of 8051
• 4. Programs using subroutine instructions of 8051
• 5. Programs using inbuilt timers of 8051
• 6. Programs using inbuilt interrupts of 8051
• 7. Programs using inbuilt interrupts of 8051
• 8. Programs using inbuilt serial facility of 8051
• 9. Interfacing of 8255 with 8051
• 10. Interfacing of 8255 with 8051
• 11. Interfacing of ADC with 8051
• 12. Interfacing of DAC with 8051
Marks Distribution
• Marks distribution
• 70 + 20 + 10 = 100 (theory)
• 15 (10- Evaluation + 5 - attendance) + 20
(Performance) + 15(Viva) = 50 (Practical)
• Seminar Presentation (In Performance) -> 5
• Class work Notebook(In Evaluation)->3
• Theory Assignments(In Evaluation) -> 2
• Quizzes(In Viva)->5
Brief Discussion
• What is Computer?
– CPU -> CU + ALU + registers
– Memory -> RAM (2 TYPES)/ ROM(4 TYPES)
– I/P AND O/P DEVICES
Cont.
• What is Microprocessor?
– 1960s’ CPU – designed with logic gates
– LSI – Large Scale Integration
– SSI to LSI – called Microprocessor
– Microcomputer
– Intel – 4 bit microprocessor 4004 in 1971
– 8 bit microprocessor 8080
– 8-bit 8085 (8 bit data bus + 16 bit address bus)
– 16-bit 8086 (16 bit data bus + 20 bit address bus)
– 16 bit processors – 8088,80186,80188, 80286
– 32 bit processors – 80386 , 80486, 80586 (P)
Microprocessors:
General-purpose microprocessor
• CPU for Computers
• No RAM, ROM, I/O on CPU chip itself
• Example : Intel’s x86, Motorola’s 680x0
• A smaller computer
• On-chip RAM, ROM, I/O ports...
• Example : Motorola’s 6811, Intel’s 8051, Zilog’s Z8
• Home
– Appliances, intercom, telephones, security
systems, garage door openers, answering
machines, fax machines, home computers, TVs,
cable TV tuner, VCR, camcorder, remote controls,
video games, cellular phones, musical
instruments, sewing machines, lighting control,
paging, camera, pinball machines, toys, exercise
equipment
Embedded Products Using Microcontrollers
• Office
– Telephones, computers, security systems, fax
machines, microwave, copier, laser printer, color
printer, paging
Embedded Products Using Microcontrollers
• Auto
– Trip computer, engine control, air bag, ABS,
instrumentation, security system, transmission
control, entertainment, climate control, cellular
phone, keyless entry
Choosing A Microcontroller
• Computing needs
– Speed, packaging, power consumption, RAM,
ROM, I/O pins, timers, upgrade to high
performance or low-power versions, cost
• Software development tools
– Assembler, C compiler, Simulators
• Availability
Companies Producing 8051
Intel www.intel.com/design/mcs51
Atmel www.atmel.com
Philips/Signetics www.semiconductors.philips.com
Siemens www.sci.siemens.com
CPU
Bus Serial
4 I/O Ports
OSC Control Port
P0 P1 P2 P3 TxD RxD
Address/Data
Features
• 8 bit CPU
• 16-bit program counter(PC) and data pointer
(DPTR)
• 8-bit program status word(PSW)
• 8-bit stack pointer
• 4 Kbytes of on-chip program memory(ROM)
• 128 bytes of on-chip data random access
memory(RAM)
• 64Kbytes of program memory address space
• 64Kbytes of data memory address space
• Two 16 bit timers/counters
• 16 bit address bus multiplexed with port 0 and port
2
• 32 bidirectional I/O lines can be either used as
8 bit ports
• On-chip clock oscillator
• Control Registers
• Serial data receiver/transmitter
• Interrupt sources
Architecture of 8051
• Processor includes
– Arithmetic and logic unit
– Instruction decoder
– Timing generation unit
– Accumulator
– B register
– Status register
Arithmetic and Logic Unit
– Performing computing functions
– Accumulator is 8-bit register
– Arithmetic and logical operations – one of the
operands is in A register
– Result is stored in only A
– C(carry), AC(auxiliary carry), O(overflow) and
P(Parity) – status register
Instruction decoder and control
• When an instruction is fetched – it is loaded in
the instruction register
• Decoder decodes the instruction and
establishes the sequence of events to follow
• Instruction cycle: Instruction cycle is defined
as the time required for completing the
execution of an instruction
• Instruction register is not programmable
• It cannot be accessed through any instruction
• Control unit generates control signals
necessary for communication between the
processor and peripherals
CPU Registers
• A Register(E0H)
– 8 bit
– Direct connection with ALU
– In multiplication- one of 8 bit operands stored in A and after
operation it stores lower byte in A
– In division- holds 8 bit dividend & quotient is stored in A
• B Register(F0H)
– 8 bit
– Used with multiply and divide operations
– In multiplication- after operation it stores higher byte in B
– In division- holds 8 bit divisor & reminder is stored in B
Registers
A
R0
DPTR DPH DPL
R1
R2 PC PC
R3
R5
R6
R7
CY AC F0 RS1 RS0 OV -- P
Add numbers 56H and 95H AND show how CY,AC and P
flags affected???
• MOV A,#56H
• MOV A,#95H
• 56 -- 0101 0110
+
• 95 --- 1001 0101
-------------------------------------
EBH -1110 1011
CY = 0 (No carry between D7)
AC = 0 (No carry from D3 to D4)
P = 0 (Accumulator has an even number of bits)
Second Exercise!
• Show status of CY,AC and P flags after the addition of
9CH and 64H
• What is the size of flag register in the 8051?
• FIND C,AY,P FOR ----MOV A,#02H
• ADD A,#3DH
• 0000 0010
• 0011 1101
• --------------
• 00 11 11 11
• MOV A,#95
• ADD A,#120
• ANS = 44 IN HEX
Third Exercise!
• Show the contents of PSW register after execution
of following instrucitons:
• MOV A,#0BFH
• ADD A,#1BH
BF – 1011 1111
1B – 0001 1011
---------------------
DA – 1101 1010 Cy=0,ac=1,f0=0,rs1=0,rs0=0,ov=0,not
used=0, p=1
• Answers: 1(CY) 1(AC) 0(P)
1001 1100
0110 0100
-------------
0000 0000
• Answers: contents of psw = 0100 0001=
(65)10= (41)16
Stack Pointer(81H)
• 8 BIT
• Contains data item on the top of stack
• Incremented before data is stored
• Initialized to 07H
Data Pointer
• DPTR (Data Pointer) consists of two 8 bit
registers – high byte (DPH) and low byte (DPL)
• 16 bit address
• To furnish address information for internal
and external program memory and for
external data memory
Program Counter
• 16 bit register
• Specifies the address of next instruction to be
executed
• After reset – PC will be set to 0000H
• 8051 fetches the instruction one byte at a
time
• After increments, it increments PC by 1
MEMORY
• 4k bytes on chip ROM
• 128 bytes RAM
• Program memory is used to hold start up program
• Data random access memory is divided into 4 parts:
First 128 bytes : 00H TO 1FH (31) – Register Banks
20H TO 2FH(47) – Bit addressable RAM
30H TO 7FH (127) – General purpose registers
Next 128 bytes : 80H TO FFH (255) – Special function
registers
Register Banks
• Lowest 32 bytes
• 4 banks – each having 8 registers
• RS1 and RS0 (4TH BIT AND 3RD BIT) program status
word select the bank
• Each bank contains R0 TO R7
• Ex: add A,R2 – adds the value contained in R2 to the
accumulator
• RS1=0 and RS0=0 – BANK 0 IS SELECTED
• R2 is which memory location? ADD A,02H
Internal RAM Organization
Special function 80 –FF
registers
General purpose registers 30-7F
Bit addressable space 20-2F
BANK 3 (R0-R7) 18-1F