Tuesday, September 15, 2009

Flashing of LEDs


Statement: Design a system (both Software and Hardware) that will cause 4 LEDs to flash 10 times when a push button switch is pressed. Use 8255. Assume persistence of vision to be 0.1 seconds.



Source program:
LXI SP, 2000 H : Initialize stack pointer
MVI A, 90H
OUT CR : Initialize 8255
BACK: IN PA : [Read status
ANI 01 : of push
JNZ BACK : button]
MVI B, 0AH : Initialize counter
AGAIN: MVI A, 00H : Load data to light LEDs
OUT PC : Send data on port C
CALL Delay : Call. Delay of 0.1 sec
MVI A, FFH : Load data to switch off LEDs
OUT PC : Send data on port C
CALL Delay : Call Delay of 0.1 sec
DCR B : Decrement count
JNZ AGAIN : If not zero repeat
JMP BACK : Jump back to read status
INTERFACING SCHEME


Delay subroutine:
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET

No comments:

Post a Comment