Professional Documents
Culture Documents
Introduction
Sudipta Mahapatra, Ph.D. Department of E & ECE IIT Kharagpur
Module-3 : I/O Interfacing Module-4 : Interrupts and Timers Module-5 : Interfacing of peripherals to 8051 Module-6 : The ARM processor Module-7: Embedded Systems
Book: 1. The 8051 Microcontroller and Embedded Systems Using Assembly and C, Mazidi M. A.. 2. Microcontrollers Principles and Applications, Ajit Pal 3. Embedded System Design, Santanu Chattopadhyay
2
Evaluation
Mid-semester examination : 30 Marks End-semester examination : 50 marks Class Test N+1 class tests, randomly taken. Out of these best N marks will be considered in the final evaluation : 15 Marks. Attendance Will also be taken randomly Attendance marks=5-Number of classes missed. Grades?
Bits, Nibbles, Bytes Conventions define relationship between bits and numbers Binary numbers (base 2), Decimal numbers (base 10), Octal numbers (base ?), Hexadecimal numbers (base ?) Conversion - (323.12)4=(?)10 Negative numbers, how to represent them Compute 5510-4410 using binary arithmetic.
Numbers
Adder Circuits
x y Cin HA HA Cout S
Half-adder
Full-adder
S0 S1 S2 S3 FA
X0 Y0 FA
X1 Y1 Carry FA
X2 Y2 Carry FA
X3
Y3 Carry
Cout
4-bit adder
CPU
Data bus
Internal Organization
A simple example
A CPU has registers A, B, C, and D and it has an 8-bit data bus and a 16-bit address bus (the CPU can access memory from addresses 0000 to FFFFH) Assume that the code for the CPU to move a value to register A is B0H and the code for adding a value to register A is 04H. The action to be performed by the CPU is to put 21H into register A, and then add to register A values 42H and 12H to it.
10
Contents of memory address (B0) // code for moving a value to register A (21) // value to be moved (04) // code for adding a value to register A (42) // value to be added (04) // code for adding a value to register A (12) // value to be added (F4) // code for halt
11
CPU Actions
1. The program counter is set to the value 1400H, indicating the address of the first instruction code to be executed 2. The CPU puts 1400H on address bus and sends it out; the memory circuitry finds the location. 3. The CPU activates the READ signal, indicating to memory that it wants the byte at location 1400H; this causes the contents of memory location 1400H, which is B0, to be put on the data bus and brought into the CPU. 4. The CPU decodes the instruction B0 and commands its controller circuitry to bring into register A of the CPU the byte in the next memory location 5. The value 21H goes into register A; the program counter points to the address of the next instruction to be executed, which is 1402H, and address 1402 is sent out on the address bus to fetch the next instruction
12
6. Code 04H is fetched from memory location 1402H; after decoding, the CPU knows that it must add to the contents of register A the byte sitting at the next address (1403). 7. After the CPU brings the value (42H), it provides the contents of register A along with this value to the ALU to perform the addition. 8. It then takes the result of the addition from the ALUs output and puts it in register A; the program counter is incremented to 1404, the address of the next instruction.
13
Memory System
14
Microprocessor
General processor microprocessors are used as the CPU in a computer system. In order to be useful these are to be interfaced with ROM, RAM and peripheral devices.
15
Microcontroller Features
On-chip oscillator Large number of Special-purpose registers. Harvard architecture On-chip program memory On-chip data memory On-chip I/O ports Watchdog timer
16
17
Size of on-chip ROM, on-chip RAM Number of I/O ports/pins Number of on-chip timer/counter Availability of on-chip serial ports Availability of on-chip ADC Availability of on-chip PWM circuit Power consumption Unit cost
18
Ask Yourself
1. What are the different number systems? 2. How to convert one number system to another? 3. What are the different logic gates, tri-state buffers, flip-flops, Half-adder, and Full-adder. How to design digital circuits? 4. Basic computer organization and operation? 5. The memory system difference between RAM and ROM in terms of usage? 6. What are the main features of a microcontroller? 7. Can you name a few popular 8-bit, 16-bit, and 32-bit microcontrollers?
19
Typical Applications
Home Appliances Intercom, telephones, security systems, garage door openers, answering machines, fax machines, 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 Office Equipments Telephones, computers, security systems, fax machines, copier, laser printer. Automobiles Engine control, air bag, ABS, instrumentation, security system, transmission control, entertainment, climate control.
20
Lecture slides for The 8051 Microcontroller and Embedded Systems: Using Assembly and C by Mazidi, Mazidi and McKinlay
Chung-Ping Young, Home Automation, Networking, and Entertainment Lab Dept. of Computer Science and Information Engineering National Cheng Kung University, TAIWAN
21