8051 Handouts from class. • The 8051 microcontroller : architecture,
programming and applications, Kenneth J. Ayala, West Publishing. • The 8051
cookbook for ...
Embedded Systems 1 Syllabus •
Microcontroller Architecture – Basic CPU and computer system architecture – Microcontroller vs Microprocessor
•
8051 Microcontroller Architecture – 8051 pin functions – 8051 register and memory organisation – 8051 timers, serial port and interrupt operation
•
Assembly Language Programming – Instruction set and addressing modes – Programming the 8051 peripherals – Assembler directives – Development Tools
Embedded Systems 1
1-1
Introduction
Syllabus (cont) •
8051 Interfacing – Keypads and displays – Switches and LEDs – DC and stepper motors – ADC, DAC – External memory – Memory mapped I/O – I/O Port Expansion
•
Address decoding
Embedded Systems 1
1-2
Introduction
Assessment •
Exam 60%
•
CA 40% – Weekly lab work – Lab exams – Mini-project
•
Note – Both the exam and CA work are fail elements – i.e. if you fail a fail element you fail the module – Fail element pass mark is 30%
Embedded Systems 1
1-3
Introduction
Recommended Reading • • • • •
8051 Handouts from class The 8051 microcontroller : architecture, programming and applications, Kenneth J. Ayala, West Publishing The 8051 cookbook for Assembly and C, S. Yeralan, Rigel Press The 8051 family of microcontrollers, Richard H. Barnett, Prentice Hall The 8051 microcontroller, I. Scott MacKenzie , Prentice Hall
Useful Websites • www.gmitweb.gmit.ie/electronics/nokeeffe – module web page – Contains lectures, lab material, tutorials and reference material • www.8052.com - good 8051 tutorial • www.keil.com - 8051 development tools (free evaluation version)
Embedded Systems 1
1-4
Introduction
Computer Architecture
Parallel I/O
CPU
Program Memory
Data Memory
Serial I/O
I/O Interface
Data Bus Address Bus Control Bus
Embedded Systems 1
1-5
Introduction
Computer Architecture •
• • •
CPU – Control unit – ALU (Arithmetic and Logic Unit) – Registers Program Memory – Stores application code and constants Data Memory – Stores variables used by application Input/Output (I/O) Interface – Interface to external peripherals – Serial peripherals e.g. GSM MODEM, GPS receiver – Parallel peripherals e.g. ADC, DAC, Displays
Embedded Systems 1
1-6
Introduction
Microprocessor vs Microcontroller •
•
Microprocessor – Main purpose - data processing – CPU , clock circuit, interrupt circuit, registers + Cache – Additional components - (peripherals) needed e.g. memory, I/O, timers etc – Very fast clock (high MIPS) – up to 3.4GHz – Large word size (typically 32 or 64 bit) – High-end applications • PC’s, Workstations • Mobile Phones Microcontroller – Single chip solution - Incorporates peripherals: eg: ROM, RAM, timers, parallel & serial I/O. – Most instructions deal with movement of data within the microcontroller. – Slower clock - max 50MHz – Smaller word size – typically 8 or 16 bit (up to 32 bit) – Lower cost than microprocessors – A system can be built using few external IC’s
Embedded Systems 1
1-7
Introduction
Microprocessor (CPU) Architecture •
•
Most instructions involve movement of data external to the microprocessor chip – Control unit controls movement of data into, out of and around the microprocessor – ALU executes all arithmetic and logic instructions – CPU contains a limited number of registers and memory To build a computer system additional components must be added
Accumulator Control Unit
Cache Memory
PC ALU
Embedded Systems 1
Working Registers
1-8
Interrupt Circuit Clock Circuit
Introduction
Microcontroller Architecture •
Most instructions involve movement of data within the microcontroller chip Small microprocessor
Power
ROM RAM
CPU Clock
I/O Ports
General Purpose Registers
I/O Pins e.g. LEDs, Switches, Keypad, Display
Timers
Data/Address/Control Bus
Embedded Systems 1
1-9
Introduction
Microcontroller Applications •
•
•
•
Consumer Electronics – Cordless phones – Televisions – CD players Automobile – Fuel injection – ABS Computers – Keyboard – Mouse – Disk controller House – Washing machine – Microwave
Embedded Systems 1
1-10
Introduction
Microcontroller Application Example •
Washing Machine – Switch inputs to select cycle, turn machine on/off – Output to control spin speed of drum – Outputs to open close water input/output valves – Outputs to turn on/off water heating elements – Outputs for LED status information – Timers control spin duration, motor speed control Motor Valves Cycle Selection Switches
µController
Heating Elements LEDs
Embedded Systems 1
1-11
Introduction
Microcontroller Projects •
Degree Level – Real time bus timetable – Golf ball positioning system using GPS – 2-dimensional plotter using a remote controlled vehicle – Remote house alarm system – Voice controlled vehicle
Embedded Systems 1
1-12
Introduction
Review of Numbering Systems •
•
•
Binary (base 2) – Digits 0 and 1 – Binary number 1010 = (1 x 23) + (0 x 22) + (1 x 21) + (0 x 20) = 10 decimal Hexadecimal (base 16) – A single hexadecimal digit can represent a 4-bit binary number (0000 to 1111) – Hex digits 0 to 9 and A to F represent the decimal numbers 0 to 15 – 5A Hex = 01011010 binary = (5 x 161) + (10 x 160) = 90 decimal – In C programming a Hex number has the prefix “0x” BCD (Binary Coded Decimal) – BCD uses a 4-bit binary code to represent a number in the range 0 to 9 decimal (0000 to 1001) – 19 decimal = 00011001 BCD = 00010011 Binary = 13 Hex
Embedded Systems 1
1-13
Introduction
Number Systems •
Complete the following table: Decimal
Binary
Hex
BCD
13
00001011
0x0D
00010011
21 00111111 0x7D 10000011
Embedded Systems 1
1-14
Introduction