;Toggling the bits of P1 and P2 on MDE 8051 Trainer with one-sec Delay
;Tested by Bassar Patel
;Connect the P1 and P2 to LEDs to see the toggling.
ORG 0
MOVA,#0
MOVP1,A ;P1 as output
MOVP2,A ;P2 as output
BACK:MOV A,#55H
MOV P1,A
MOVP2,A
ACALLSDELAY;one sec delay
MOV A,#0AAH
MOV P1,A
MOVP2,A
ACALLSDELAY
SJMPBACK
;-------------------------
;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:
MOVR5, #45
H3:MOVR4, #242
H2: MOVR3, #255
H1:DJNZR3, H1
DJNZR4, H2
DJNZR5, H3
RET
;-----------------------
EN D
http://www.microcontroller.tk
0 comments:
Post a Comment
If you have any questions or droughts feel free to ask here.