Lecture 2 Mid Sem
Lecture 2 Mid Sem
BY
DR. SUPRATIM GUPTA
2
MICROCOMPUTER SYSTEM
Features
Input / Output
• 2K Bytes EPROM
ALU Register Array
• 256 Bytes RAM
System Bus • 1 Timer/Counter
• 4 8-bit I/O port
Memory
• 1 6-bit I/O port
Control Unit
ROM RAM • 4 Interrupt levels
• Serial in / Serial out ports
Microprocessor
3
THE 8085 PIN DIAGRAM
Microprocessor
GENERAL MEMORY STRUCTURE
5
EPROM RAM
MEMORY INTERFACING: BASIC SIGNALS
1. Selection of the chip : Enables us to page the memories
2764 7
8755A
THE MEMORY CHIPS: RAM
8156 8
THE MEMORY CHIPS: RAM
8156 6264 9
MEMORY INTERFACE WITH 8085
10
ADDRESS DECODER: 8205
11
ADDRESS DECODER: 74LS138
12
MEMORY INTERFACE WITH 8085
13
MEMORY INTERFACE WITH 8085
14
MEMORY TYPES
15
CHAPTER – 3: PARALLEL & SERIAL INTERFACING
16
8085 I/O STRUCTURE
External Internal
• Interrupt driven I/O: In interrupt driven I/O, the I/O device will interrupt
the processor, and initiate data transfer.
• Direct memory access (DMA): In DMA, the data transfer between memory
and I/O can be performed by bypassing the microprocessor.
18
PROGRAMMABLE PERIPHERAL INTERFACE: 8255
19
PROGRAMMABLE PERIPHERAL INTERFACE: 8255
1 1 1 0 0
20
8255 IN STANDARD I/O CONFIGURATION
21
8255 IN STANDARD I/O CONFIGURATION
AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 Port/ Register
1 1 1 1 1 1 0 0 PORT A
0 1 PORT B
1 0 PORT C
=0 1 1 Control Register
FC PORT A
FD PORT B
FE PORT C
FF Control Register
22
8255 IN MEMORY MAPPED I/O CONFIGURATION
Sl.No Opcode Operand Hex Code Affected
Flags
1. STA 16-bit Add. 32 No Flag
2. LDA 16-bit Add. 3A No Flag
Reg. Hex
Pair Code
5. STAX B/D Reg. BC 02 No Flag
pair
DE 12
6. LDAX B/D Reg. BC 0A No Flag
pair 23
DE 1A
8255 IN MEMORY MAPPED I/O CONFIGURATION
AD15 AD14 AD13 AD12 AD11 AD10 AD9 AD8
=0 1 X X X X X X X
AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 Port/ Register
X X X X X X 0 0 PORT A
0 1 PORT B
1 0 PORT C
1 1 Control Register
8000 PORT A
8001 PORT B
8002 PORT C
27
8255: CONTROL WORD
28
8255: CONTROL WORD FOR BSR MODE
29
8255 IN MODE 1: INPUT CONFIGURATION
INTEA PC4
INTEB PC2
30
8255 IN MODE 1: OUTPUT CONFIGURATION
INTEA PC6
INTEB PC2
31
8255 IN MODE 2: OUTPUT CONFIGURATION
32
ASSIGNMENTS
33
34
8255: KEY BOARD INTERFACING
PC0 35
ROBUST KEYBOARD OPERATIONS: HUMAN FACTORS
Schmitt Trigger
• De-bounce/Accidental Key hit: To wait until a time interval –longer than the manufacturer’s
specification –lapses during both key press & release.
• Multiple Key press: To use only a valid key patterns –all other patterns will be ignored; the first
valid key patterns will be accepted
• Key Hold: To identify valid key press if the same valid pattern exists after the de-bounce delay
• Rapid Key hit: Keys are scanned at a rate faster than human reaction time
THE ALGORITHM FOR KEYBOARD INTERFACE
• Step 3: Check if same switch is remained pressed else return to main routine
• Step 4: Check if valid key pattern is pressed else return to main routine
• Key scanning via polling: May sluggish, but usable for small keypad & less
number of multi-task environment
• Key scanning via interrupt: CPU will scan keys when interrupted; Optimal for
large key board & larger number of multi-tasking environment
KEYBOARD CONFIGURATION: LEAD-PER-KEY
KEYBOARD CONFIGURATION: MATRIX
KEYBOARD CONFIGURATION: CODED KEYBOARD
8255 INTERFACE WITH 7-SEGMENT DISPLAY
8255 INTERFACE WITH 74LS244 OCTAL BUFFER
8255 INTERFACE WITH 74LS244 OCTAL BUFFER
8255 Characteristics
8255 INTERFACE WITH 74LS244 OCTAL BUFFER
7-Segment LED Characteristics
8255 INTERFACE WITH 74LS244 OCTAL BUFFER
74LS244 Characteristics
THE ALGORITHM FOR 7-SEGMENT LED DISPLAY
• Step 3: Use index addressing –Base address + index (the nibbles of BCD no.) -to a look up
table for fetching code for 7-Segment LEDs
• Step 4: Send the code to Port where the unit(s) is (are) connected
HEX TO BINARY CODED DECIMAL CONVERSION
55
HEX TO BINARY CODED DECIMAL CONVERSION
• Let us consider a decimal number and its hexadecimal representation as
.
× × × × ×
Step 1: in both the system and a
remainder
× × × ×
Step 2: in both the system and a remainder
56
HEX TO BINARY CODED DECIMAL CONVERSION
• Alternative Approach for same number .
or in general form
After every unit operation we need to adjust the overflow in the nibbles beyond 9 or
AC is generated
57
HEX TO BINARY CODED DECIMAL CONVERSION
• Alternative Approach for same number .
10 ; For 9
⋮ ; For 2 - 8
79 ; For 1
LUTB: 40 ; For 0
RET
OUT 81H
MOV A, M ;Get the code from the memory
MOV L, A
ADD L
Display: LXI H, LUTb ; Store the base address of LUT
MOV A, B ; Get the number /character to be displayed in A
59
EPROM
INDEX ADDRESSING FOR DISPLAY CODE RETRIEVAL
A B
10 8013
10
13
XX
09 09
⋮
H L
79 800B
LUTb: 40 800A XX
80 13
0A
XX
RET 8009
OUT 81H 8007
Program Counter
MOV A, M 8006
MOV L, A 8005 8009
8006
8007
8001
8000
8004
8005
ADD L 8004
Display: LXI H, LUTb 8001 PORT B OF 8255
MOV A, B 8000 XX
10
62
ADC0809: SPECIFICATIONS
63
ADC0809: SPECIFICATIONS
64
ADC INTERFACING
65
ADC INTERFACING WITH 8255 IN MODE 0 & BSR
+5V
OE ALE VCC
+5V
66
ADC INTERFACING: ALGORITHM
67
ADC INTERFACING: DETERMINING SAMPLING FREQUENCY
• OE (if connected)
ADC INTERFACING: DETERMINING SAMPLING FREQUENCY
69
𝒇𝑪𝒍𝒌:𝑨𝑫𝑪 𝒇𝑺𝒂𝒎𝒑𝒍𝒆 𝒇𝑪𝒍𝒌:𝑨𝑫𝑪
𝑺𝒂𝒎𝒑𝒍𝒆 𝑵 and the signal bandwidth is 𝟐 𝟐𝑵
ADC INTERFACING: BIPOLAR SIGNAL
+5V
OE ALE VCC
D7-D0
IN0 PA
ADC0809 8255
EOC PC0 𝐶𝑆 A7
C A1 A1
B SC PC7 A0 A0
A
Vref- Vref+
+5V
70
DAC INTERFACING: DAC0808
𝐴 𝐴 𝐴 𝑉 𝐴 𝐴 𝐴
𝐼 =𝐼 + + …+ 𝐼 = + + …+
2 4 256 𝑅 2 4 256
71
DAC INTERFACING: DAC0808
𝐴 𝐴 𝐴
𝐼 =𝐼 + + …+
𝑅 2 4 256
𝑉 𝐴 𝐴 𝐴
𝑅 𝐼 = + + …+
𝑅 2 4 256
𝑉 𝐴 𝐴 𝐴
𝑉 = + + …+ 𝑅
𝑅 2 4 256
72
DAC INTERFACING WITH 8255 IN MODE 0 & BSR
+5V
OE ALE VCC
+5V I0
DAC0809
73
DAC INTERFACING: BIPOLAR OUTPUT SIGNAL
PA D7-D0 AD7-AD0
8255 Micro-Computer
with 8085 𝜇P
PC0 𝐶𝑆 A14
A1 A1
PC7 A0 A0 ALE
PB 74LS373
DAC0809
I0
74