课本代码LED户外广告程序范例:
.AREA
HOME(ABS,CODE)
.ORG
0x0000
Start:
MOV
DPTR,#Table
Loop: CLR
A
MOVC
A,@A+DPTR
CJNE
A,#0x55,Loop1
AJMP
Start
Loop1:MOV
P1,A
MOV
R6,#0X00
Delay: MOV
R7,#0x00
DJNZ
R7,$
DJNZ
R6,Delay
INC
DPTR
AJMP
Loop
Table: .DB 0x81,0x80,0x79,0x78,0x77,0x76,0x75,0x74,0x73,0x72,0x71,0x70,0x69,
.DB 0x68,0x67,0x66,0x65,0x64,0x63,0x62,0x61,0x60,0x59,0x58,……0x46
.DB 0x55
我设计的:
.AREA
HOME(ABS,CODE)
.ORG
0x0000
Start:
MOV
R0,#00001011B
Loop: INC
R0
CJNE
R0,#0x55
MOV
A,R0
MOVC
A,@A+PC
MOV
P1,A
MOV
R6,#0X00
Delay:MOV
R7,#0x00
DJNZ
R7,$
DJNZ
R6,Delay
AJMP
Loop
0x81
0x80
……
0x46
0x55
跳转是Start。
|