Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PPT

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 56

Microprocessors and 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

What is Microprocessor?

Cont.

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 ExampleIntels x86, Motorolas 680x0
Many chips on mothers board

CPU GeneralPurpose Microprocessor

Data Bus

RAM

ROM

I/O Port

Timer

Serial COM Port

Address Bus General-Purpose Microprocessor System

Limitations of (8085) Microprocessor


Operates with Low speed Less powerful addressing mode and instruction set Limited no. of 8 bit general purpose registers Low memory 64kbytes addressing Requires external memory to execute a program Cannot directly interfaced with I/O devices. Peripheral chips are needed to interface with I/O devices

What is Microcontroller?
LSI to VLSI called Microcontroller To build Microprocessor, memory and I/O devices on a single chip Components Microprocessor A/D Converter D/A Converter Parallel I/O Interface Serial I/O Interface Timers and Counters

Microcontroller :
A smaller computer On-chip RAM, ROM, I/O ports... ExampleMotorolas 6811, Intels 8051, Zilogs Z8

CPU

RAM ROM

A single chip
I/O Port
Serial Timer COM Port Microcontroller

Microprocessor vs. Microcontroller


Microcontroller Microprocessor CPU, RAM, ROM, I/O and CPU is stand-alone, RAM, timer are all on a single chip ROM, I/O, timer are fix amount of on-chip ROM, separate RAM, I/O ports designer can decide on the for applications in which cost, amount of ROM, RAM and power and space are critical I/O ports. single-purpose expansive versatility general-purpose

Microcontroller vs. Microprocessors

Cont.
Which is the first task faced when learning to use a new computer?
Internal hardware design (architecture) Type, number and size of registers Other circuitry Hardware and software of microcontroller

Embedded Computing Systems


Use a microprocessor or microcontroller to do one task only
Printer

PC used for any number of applications


Word processor, print-server, bank teller terminal, video game player, network server, internet terminal

PC contains or is connected to various embedded products


Keyboard, printer, modem, disk controller, sound card, CD-ROM driver, mouse

Embedded Products Using Microcontrollers


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

Company Intel Atmel Philips/Signetics Siemens

Web Site www.intel.com/design/mcs51 www.atmel.com www.semiconductors.philips.com www.sci.siemens.com

Dallas Semiconductor

www.dalsemi.com

8051 Family
Feature
ROM (on chip program space in bytes) RAM (bytes) Timers I/O pins Serial port Interrupt sources

8051
4K 128 2 32 1 6

8052 8031
8k 256 3 32 1 8 0k 128 2 32 1 6

Timer: : : Timer

Interrupt :

Various 8051 Microcontrollers


8751 microcontroller
UV-EPROM

AT89C51 from Atmel Corporation (IN LAB WITH KEIL COMPILER)


Flash (erase before write)

DS5000 from Dallas Semiconductor


NV-RAM (changed one byte at a time), RTC (real-time clock)

OTP (one-time-programmable) version of 8051 8051 family from Philips


AD, DA, extended I/O, OTP and flash

8051 Microcontroller

Block Diagram of 8051


External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter

On-chip RAM

Timer 1 Timer 0

Counter Inputs

CPU
Serial Port

OSC

Bus Control

4 I/O Ports

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 B R0 R1 R2 R3 R4 R5 R6 Some 8051 16-bit Register PC PC DPTR DPH DPL

R7 Some 8-bitt Registers of the 8051

Program status word(D0H)


CY AC CYPSW.7 AC PSW.6 F0 PSW.5 RS1-PSW.4 F0 RS1 RS0 Carry flag Auxiliary carry General purpose Register bank selector bit 1 OV -P

RS0-PSW.3 OV-PSW.2
-PPSW.0

Register bank selector bit 0 Overflow flag


User defined bit Parity flag

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 registers
General purpose registers Bit addressable space 80 FF

30-7F 20-2F

BANK 3 (R0-R7)
BANK 2 (R0-R7) BANK 1 (R0-R7) BANK 0 (R0-R7)

18-1F
10-17 08-0F 00-07

PSW bits bank selection


BANK 0 BANK 1 BANK 2 Bank 3 RS1 PSW.4 0 0 1 1 RS0- PSW.3 0 1 0 1

Bit Addressable RAM 20H TO 2FH


16 BYTES Bit variables can have value 0 or 1 SETB 25H // sets the bit 25H (becomes 1) CLR 25H // clears the bit 25H (becomes 0) SETB 19H // WRONG

General Purpose RAM 30H TO 7FH


80 BYTES Instructions of single byte operands use this area of storage Direct or indirect addressing modes

SFR Register 80h to ffh


21 SFR registers are defined Some registers are bit addressable Access by internal RAM locations CPU and internal peripheral modules use SFR for controlling the desired operation of the device Contains I/O ports, control registers, timers, serial ports etc. Ex : acc, B, PSW, sp, dptr etc.

MOV A,R5 is equivalent to?


Which register bank of r0-r7 do we have access to when 8051 is powered up? Ans register bank 0 RAM LOCATIONS 0,1 to 7 By r0 to r7 How to switch register banks? By bit addressable instructions SETB and CLR SETB PSW.3 - will make PSW.3 =1 so 0(PSW.4)AND 1 BANK1 IS SELECTED

Which is the other way to write below program


State the contents of RAM LOCATIONS after following program:
MOV R0,#99H MOV R1,#50H MOV R2,#60H MOV R3,#90H MOV R4,#65H
RAM LOCATION 0 HAS VALUE 99H RAM LOCATION 1 HAS VALUE 50H RAM LOCATION 2 HAS VALUE 60H RAM LOCATION 3 HAS VALUE 90H RAM LOCATION 4 HAS VALUE 65H

Write instructions to use the registers of bank 3 and load the same value 05H in reg. r0-r3
SETB PSW.4 SETB PSW.3 MOV R0,#05H MOV R1,#05H MOV R2,#05H MOV R3,#05H

Example: the following instructions enable register bank 3 and move the content of R7 (address 1FH) to the accumulator SETB RS1 SETB RS0 MOV A,R7

You might also like