Documente Academic
Documente Profesional
Documente Cultură
?
About the Course
Microprocessors :
General-purpose microprocessor
CPU for Computers No RAM, ROM, I/O on CPU chip itself ExampleIntels x86, Motorolas 680x0
Data Bus Many chips on mother board
RAM
ROM
I/O Port
Timer
Microcontroller :
A smaller computer On-chip RAM, ROM, I/O ports... ExampleMotorolas 6811, Intels 8051, Zilogs Z8 and PIC 16X
CPU RAM ROM
A single chip
I/O Port Timer Serial Port Microcontroller
Lab Organization
Lab 1 :
Identify the basic functions available in the AES-51 development board. Run the self-test program and familiar with the each functions of the AES-51 development board. Familiar with the 8052 simulator Assemble the programs written in Assignment #1 and observe the results by using AES-51 development board.
Prerequisites
An understanding of decimal, hexadecimal and binary number systems. A general knowledge of hardware.
Software Use
Compiler : ASM 51
http://www.metaice.com/ASM51/ASM51.htm
Simulator : 8052
http://www.vaultbbs.com/sim8052/download.php
Write a simple Assembly Language Program (ALP) to perform simple arithmetic operations.
Translation Process
Machine Language Object File Translates the source file Generates the listing
Block Diagram
External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter
On-chip RAM
Timer 1 Timer 0
Counter Inputs
OSC
Bus Control
4 I/O Ports
P0 P1 P2 P3
TxD RxD
Address/Data
8051 (8031)
Types of Memory
On Chip Memory
Registers
A B R0 R1 R2 R3 R4 R5 R6 R7 Some 8-bit Registers of the 8051 Some 8051 16-bit Register PC PC DPTR DPH DPL
The register used to access the stack is called SP (stack pointer) register. 30H
2FH
The stack pointer in the 8051 is only 8 bits wide, which means that it can take value 00 to FFH. When 8051 powered up, the SP register contains value 07.
Bit-Addressable RAM 20H 1FH 18H 17H 10H 0FH 08H 07H 00H
Addressing Modes
Immediate Addressing Direct Addressing Indirect Addressing External Direct Code Indirect MOV A,#20h MOV A,30h MOV A,@R0 MOVX A,@DPTR MOVC A,@A+DPTR
Conditional Jumps :
JZ JNZ DJNZ CJNE A,byte CJNE reg,#data JC JNC JB JNB JBC Jump if A=0 Jump if A/=0 Decrement and jump if A/=0 Jump if A/=byte Jump if byte/=#data Jump if CY=1 Jump if CY=0 Jump if bit=1 Jump if bit=0 Jump if bit=1 and clear bit
Timers
Keeping time and/or calculating the amount of time between events, Counting the events themselves, or Generating baud rates for the serial port.
Timer SFR
SFR Name Description SFR Address
TH0
TL0 TH1 TL1 TCON TMOD
8Ch
8Ah 8Dh 8Bh 88h 89h
TMOD (89 H)
Bit 7 Name GATE1 Explanation of Function Timer When this bit is set the timer will only run when INT1 (P3.3) is high. When this bit is clear the timer will run 1 regardless of the state of INT1. When this bit is set the timer will count events on T1 (P3.5). When this bit is clear the timer will be 1 incremented every machine cycle. Timer mode bit (see below) 1 Timer mode bit (see below) 1 When this bit is set the timer will only run when INT0 (P3.2) is high. When this bit is clear the timer will run 0 regardless of the state of INT0. When this bit is set the timer will count events on T0 (P3.4). When this bit is clear the timer will be 0 incremented every machine cycle. Timer mode bit (see below) 0 Timer mode bit (see below) 0
6 5 4 3
2
1 0
C/T0
T0M1 T0M0
Timer Modes
TxM1 TxM0 0 0 1 1 0 1 0 1
Timer Mode 0 1 2 3
Description of Mode 13-bit Timer. 16-bit Timer 8-bit auto-reload Timer mode
TCON SFR
Bit Name 7 6 5 4 TF1 TR1 TF0 TR0 Bit Address 8Fh 8Eh 8Dh 8Ch Explanation of Function Timer 1 Overflow. This bit is set by the microcontroller when Timer 1 overflows. Timer 1 Run. When this bit is set Timer 1 is turned on. When this bit is clear Timer 1 is off. Timer 0 Overflow. This bit is set by the microcontroller when Timer 0 overflows. Timer 0 Run. When this bit is set Timer 0 is turned on. When this bit is clear Timer 0 is off. Time r 1 1 0 0
TCON SFR
Bit Name 7 6 5 4 TF1 TR1 TF0 TR0 Bit Address 8Fh 8Eh 8Dh 8Ch Explanation of Function Timer 1 Overflow. This bit is set by the microcontroller when Timer 1 overflows. Timer 1 Run. When this bit is set Timer 1 is turned on. When this bit is clear Timer 1 is off. Timer 0 Overflow. This bit is set by the microcontroller when Timer 0 overflows. Timer 0 Run. When this bit is set Timer 0 is turned on. When this bit is clear Timer 0 is off. Time r 1 1 0 0
Using Timers
Initializing a Timer Reading the value of a Timer Or Detecting Timer Overflow Timing the length of events
P0.0 DS5000 P0.1 P0.2 8751 P0.3 P0.4 8951 P0.5 P0.6 P0.7
Port 0
Course Summary
Learn a lot