MDE8051 Toggle
MDE8051 Toggle
;Tested by M. Mazidi
;Modified from Examples in chaps 3 and 8 of 8051 Microcontroller book by Mazidis &
McKinlay
;Connect the P1 and P2 to LEDs to see the toggling.
ORG 0
MOV A,#0
MOV P1,A ;P1 as output
MOV P2,A ;P2 as output
BACK: MOV A,#55H
MOV P1,A
MOV P2,A
ACALL SDELAY ;one sec delay
MOV A,#0AAH
MOV P1,A
MOV P2,A
ACALL SDELAY
SJMP BACK
;-------------------------
;One sec. delay for DS89C4x0 with MDE8051 Trainer
;XTAL=11.0592 MHz on MDE8051, 1/11.0592 MHz=90 nsec
;45 x 255 x 242 x 4 x 90 ns = 999.7 msec
;Notice DS89C4x0 uses 4 clocks for Machine Cycle.
SDELAY:
MOV R5, #45
H3: MOV R4, #242
H2: MOV R3, #255
H1: DJNZ R3, H1
DJNZ R4, H2
DJNZ R5, H3
RET
;-----------------------
END