Model Answer, Statistics and Verdict of Mid Semester Exam
Dr A Sahu
Dept of Comp Sc & Engg.
IIT Guwahati
Outline
Question No 1
Question No 1
Question No 1
Question No 1
Question No :2
Design a circuit block diagram to refresh the above designed graphics screen at 30frame/S. What should be Clock values for the both row and column counter to perform at this rate? What should be maximum delay of such YUV to RGB decoder?
Model Answer to question 2
0
1
2
3
4
5
1
2
3
0 1 2
0
1
R.CTR
C.CTR
Y1
Y2
Y3
Y4
U
V
Model Answer to question 2
0
1
2
3
4
5
1
2
3
0 1 2
0
1
Multiplication
addition
Clock and Decoder Delay
(1.736/4)*10-8S
Question 4
[10] Design interface and write interface program to interface seven I/Os devices namely Emergency actions, A/D converter, Heater, Keyboard, Display, Special money transaction device and printer using 8259 interrupt controller. Design interface the circuit to work at address 80H for ICW1 and 81H for ICW2. Special money transaction device have lower priority then Emergency actions. You have to ensure that Special money transaction device should not be interrupted once its ISR started till the end of its ISR using mask bit. Assume interrupt vector address for each interrupts and use properly in your interface program.
Determine the values of ICWs, OCWs in this case for your interface structure. Draw the interface diagram and write interfacing (8085 assembly) program (to initialize ICWs & OCWs) to perform this work.
Example: Setting of control word
8259
IR0
IR1
IR2
IR6
Emergency
Spe. MoneyT
A/DC
Keyboard
Monitor
Heater
Printer
3-to-8
Decoder
CSb
A0
E1b E2b E3
A2
A1
A0
A3
A2
A1
A7
A6
A5
A0
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | M7=1 | M6=1 | M5=1 | M4=1 | M3=1 | M2=1 | M1=0 | M0=1 |
| Interrupt Masks: 1= Mask Set, 0 =Mask reset | |||||||
OCW1=FDH
ADDRESS= 80H, 81H
04
Initialization words (ICW1 & ICW2)
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |
| A7, A6,A5 Lower address bit of Vector Address | | 0 for Edge Trigger | Call Address interval =4 | 1=single 0=Cascade | | ||
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | T7 | T6 | T5 | T4 | T3 | T2 | T1 | T0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| T7=T0 is the assign to IR0, Vector address for ISR Lower Byte of call address | |||||||
76H
20H
Vector Address 2060, 2064…. | 0100 0000 | 0 1 1 | 00000 |
Program to initialize
DI
MVI A, 76H ;move ICW1 byte to ACC
OUT 80H ; initialize 8259A ICW1
MVI A, 20H ; Mov ICW2 byte to ACC
OUT 81H ; Initialize 8259A ICW2
MVI A, FDH ; Put the OCW1
OUT 80H
Question 5
Interface : For Address 5FH & 5EH
2
3
7
2
3
7
Transmit
Receive
8251A
TxD
RxD
RxCb
TxCb
CLK
CTSb GND
8085
MPU
D7
D0
CSb
C/Db
A7
A1
A0
Voltage Converter
IORb
IOWb
Reset Out
CLK Out
RDb
WRb
RESET
CLK
D7
D0
Control & Status Register Address=5FH
C/Db line should be high, == > A0 =1
Initialization of UART: 9600baud, 8 bit char , 2 stop bit, WO parity
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 |
Two Stop bits | No parity | 7 bit characters | Baud=TxC/16 =153.6k/16 =9600 | ||||
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
X | 0 | X | 1 | X | 0 | X | 1 |
| | | ERR Reset | | Receive Disable | | Transmit Enable |
Mode
Word
COMMAND WORD
STATUS
CEH
11H
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
X | X | X | X | X | X | X | 1 |
| | | | | | | Transmit Ready |
01H
Initialization instructions
SETUP: MVI A,CEH ; load mode word
OUT 5FH ;Write mode word in control register
MVI A,11H ; load command word to enable TX
OUT 5FH ;Enable the transmitter
STATUS: IN 5FH ; Read the status register
ANI 01H ; Mask all bit except D0
JZ STATUS ; if D0=0 the TX buffer if full
Write a program to display message at CRT terminal
LXI H 2070H ; Meory ptr for Message
MOV C, M ; Set up Ctr register
MVI A,40; Reset 8251
OUT 5FH
MVI A,CEH; Initialize 8251
OUT 5FH
MVI A,11 ; initialize for transmit
OUT 5FH
STATUS: IN 5FH
ANI 01H ;Ckeck TxRDY
JZ STATUS ; is txRDY 1 ? If not wait
INX H ; Pont to Next Char
MOV A,M ; place the Char in ACC
OUT 5EH ; Send the Char to Transmitter
DCR C ; DCr cnt
JNZ STATUS ;Again Send the rest of Char
HLT
Question 3
8254 Block Diagram
Data
Bus
Buffer
Read/
Write
Logic
Counter
0
CLK 0
GATE 0
OUT 0
Internal
Bus
Control Word
Register
Counter
1
CLK 1
GATE 1
OUT 1
Counter
2
CLK 2
GATE 2
OUT 2
D0-D7
RDb
WRb
A1
A0
CSb
A7
A6
A5
A4
A3
A2
A1
A0
A1 | A0 | Selection |
0 | 0 | Counter 0 |
0 | 1 | Counter 1 |
1 | 0 | Counter 2 |
1 | 1 | Control Register |
INTR
70
71
72
73
Write a SR to generate an interrupt every 1 Second
Instruction to set up 1s interrupt
MVI A , 74H ; Mode for 1st CTR
OUT 73H ;Write in control register
MVI A,94H ; Mode for 2nd CTR
OUT 73H ; Write to control register
MVI A,F4H ; Mode for 3nd CTR
OUT 73H ; Write to control register
MVI A,50 ; low byte of CTR1=C350
OUT 70H ; load to CTR1 low byte
MVI A,C3 ; high byte of CTR1=C350
OUT 70H ; load to CTR1 high byte
MVI A,28H ; Count for Counter 2
OUT 71H ; Load Counter 2
MVI A,C0 ; low byte of CTR3=A8C0H
OUT 72H ; load to CTR1 low byte
MVI A,A8 ; high byte of CTR3=A8C0H
OUT 72H ; load to CTR1 high byte
Control word
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
SC1 | SC2 | RW1 | RW0 | M2 | M1 | M0 | BCD |
01 | Load 16 bit (11) | 010 (mode 2) | 0 | ||||
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
SC1 | SC2 | RW1 | RW0 | M2 | M1 | M0 | BCD |
10 | Load 8 bit (01) | 010 (mode 2) | 0 | ||||
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
SC1 | SC2 | RW1 | RW0 | M2 | M1 | M0 | BCD |
11 | Load 16 bit (11) | 010 (mode 2) | 0 | ||||
Require 8255
- Two 8-bit ports and two 4-bit ports
- Any port can be input or output
- Outputs are latched, inputs are not latched
I/O port Addressing-8255
8255
CSb
A1
A0
RDb
WRb
A7
A6
A5
A4
A3
A2
A1
A0
IORb
IOWb
Reset
Reset
Port A=80H
Port C=82H
Port B=81H
CSb | A1 A0 | HEX Address | Port |
A7 A6 A5 A4 A3 A2 1 0 0 0 0 0 | A1 A0 0 0 |
= 80H | A |
| 0 1 | =81H | B |
|
| =82H | C |
|
| =83H | Control Register |
8255: Mode 0, Example 1
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
I/O function | Port A in Mode 0 | Port A as O/P | Port CU As O/P | Port B in Mode 0 | Port B As O/P | Port CL As O/P | |
80H
Interface Program
MVI A,80H ; Load acc with Control word
OUT 83H ; Load control register with 83 at port address 83
CALL BUSYWAIT()
ISRDISPLY:
CALL GETTIMESTOREAT2000()
MOV A, 2000H
OUT 81H ; Write to LEDs
MOV A, 2001H
OUT 82H ; Write to LED
MOV A, 2002H
OUT 83H ; Write to LED
RET
Thanks