Sunday, September 13, 2009

Generate square wave from SOD pin (8085)




Statement: Write a program to output square wave of 1 kHz frequency on the SOD pinof 8085 for 5 seconds. Operating frequency of 8085 is 2 MHz.





Source program
LXI SP, 27FFH : Initialize stack pointer
LXI B, 1388H : Initialize counter with count 5000.
BACK: MVI A, COH
SIM : Send high on SOD pin
CALL DELAY : Wait for 0.5 msec
MVI A, 40H : Send low on SOD pin
CALL DELAY : wait for. 5 msec
DCX B : Decrement count by 1
MOV A, C
ORA B : Check if count = 0
JNZ BACK : If not, repeat
HLT : Stop program execution
Delay subroutine:
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET


1 comment: