ELET2100 (EL21C) - MICROPROCESSORS I
COURSE TEST #2 – WEDNESDAY 22nd NOVEMBER 2006
SOLUTIONS
( 1 ) Which control signals are activated when the OUT instruction is executed ? [2]
IO/M = 1 ; WR = 0
( 2 ) Use these signal, and any other signals from the address & data bus, to turn ON
an LED using the instruction OUT 45H (show logic gates used). [4]
Many solutions possible …. this one uses XOR gates:
( 3 ) An 8-bit A/D converter gives full-scale for an analog input voltage of 2.00V.
What is the resolution of the device ? [2]
8-bits = FFH = 255 (dec.) maximum value over 2.00V or 2000 mV. Therefore, each
‘step’ = 2000/255 = ~ 7.84 mV. Resolution = ± 7.84/2 = ± 3.93 mV
( 4 ) The EOC pin of the A/D converter is connected to the RST5.5 pin on an SDK-85 kit
in the lab. The OE pin is interfaced to Bit 0 of Port 21H and the A/D data
pins are interfaced to Port 22H. Write code to read the A/D data into memory
location 20A0H. [4]
MVI A, 01H ; Port 21H = Out &
OUT 20H ; Port 22H = In
MVI 81H ; Enable RST5.5 &
SIM ; Disable other interrupts
.
.
A/D is triggered to begin conversion and when done, EOC will automatically trigger
the RST5.5 pin. This will cause the CPU to jump to 5.5 * 8 = 44 = 002CH. At this location, the following code:
DI ; Disable interrupts
LXI H, 20A0H ; HL points to 20A0H
MVI A, 01H ; Bit 0 = 1
OUT 21H ; Enable OE pin
IN 22H ; Read A/D data into A
MOV M, A ; Store it in memory
MVI A, 0 ; Bit 0 = 0
OUT 21H ; OE = 0
.
( 5 ) If the output of the A/D converter is 8FH. What is the analog input voltage ? [2]
From Question 3, each step (value) = 7.84 mV. Therefore, 8FH = 143 would be
equivalent to 143 * 7.84 = 1121 mV = 1.121 V
( 6 ) Sketch the waveform for the following serial transmission using 8-bit data, even
parity, one stop bit, 9600 baud: ASCII character (75H). [4]
75H = 0111 0101 = odd parity so our Parity bit must be 1 to bring parity to Even.
We start by sending bit 0:
( 7 ) How long does it take to transmit the total frame ? [2]
Total frame = 11 bits. Baud rate = 9600 bits per sec. One bit will take:
1/9600 = 104.17 μs. Therefore, 11 bits will take: 11 * 104.17 = 1145.87 μs
( 8 ) How many characters can be transmitted in 1 second ? [2]
9600 / 11 = 872 characters
( 9 ) Show the contents of the Stack, the SP-register, and the A-register, after the
following code is executed: Stack SP A-reg.
LXI SP, 3000H ???? 3000 ??
MVI A, 24H ???? 3000 24
MOV C, A ???? 3000 24
MVI B, 12H ???? 3000 24
PUSH B 1224 2FFE 24
HLT [4]
( 10 ) The subroutine DLAY, which you use in the lab, is shown below.
Determine exactly the time this routine takes if it is entered with DE=0032h.
What registers are destroyed ? (Assume 8085 clock crystal = 3 MHz) [3+1]
DLAY: DCX D [ 6 states ]
MOV A, D [ 4 states ]
ORA E [ 4 states ]
JNZ DLAY [7/10 states] = (24 * 49) cycles
RET [10 states ] + 31 cycles
Counter = 32H = 50. Total cycles = (24 * 49) + 31 = 1207 cycles.
Each cycle = 1/3 x 10 -6 . Total = 1207 x 1/3 x 10 -6 = 402 μs.
Registers A, D, E are destroyed.
Bonus mark:
What is the Date of the final exam for this course ?
Monday 18th December 2006
[ Maximum mark = 30 ]
NB: Add marks for Class Test #1 & 2 (total out of 60). Divide by 3 to convert to 20% of Final. Please hand-in all Lab Reports by end of Week 13.
Coursework (20%) and Lab (20%) marks will be posted on Notice Board outside my Office on/after Monday 4th December 2006. Please report errors as soon as possible !!!