微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 单片机十字旋转LED程序

单片机十字旋转LED程序

时间:11-23 来源:互联网 点击:

ORG 0000H
MAIN: MOV DPTR,#TAB
MOV R2,#0
MM: MOV A,R2
MOVC A,@A+DPTR
lcall hbit
CPL A
MOV R4,A
INC R2
MOV A,R2
MOVC A,@A+DPTR
lcall hbit
CPL A
MOV R3,A
INC R2

MOV P0,R4
MOV P2,R3
DJNZ R6,$
DJNZ R6,$
MOV A,R2
CJNE A,#128,mm ;其中的128代表四个汉字的长度,1个汉字32,2个64----8个到255.
LJMP main

hbit: ;字符颠倒
mov c,acc.0
mov b.7,c
mov c,acc.1
mov b.6,c
mov c,acc.2
mov b.5,c
mov c,acc.3
mov b.4,c
mov c,acc.4
mov b.3,c
mov c,acc.5
mov b.2,c
mov c,acc.6
mov b.1,c
mov c,acc.7
mov b.0,c
mov a,b
ret

TAB: ;具体显示内容,这里是4个汉字
db 08h,20h,06h,20h,80h,7eh,63h,80h
db 0ch,04h,00h,04h,20h,04h,20h,04h
db 20h,04h,3fh,0fch,20h,04h,20h,04h
db 20h,04h,20h,04h,00h,04h,00h,00h
db 20h,00h,20h,02h,22h,32h,22h,0e4h
db 22h,08h,0fah,30h,22h,0e0h,2fh,80h
db 22h,04h,0fah,02h,22h,02h,23h,0fch
db 20h,00h,20h,40h,20h,30h,00h,00h
db 20h,00h,20h,00h,27h,0feh,24h,20h
db 24h,0a0h,26h,0a0h,2dh,0a0h,0f4h,0feh
db 24h,0a0h,25h,0a0h,26h,0a0h,24h,0a4h
db 24h,22h,67h,0fch,20h,00h,00h,00h
db 00h,00h,20h,04h,20h,08h,27h,98h
db 24h,0b0h,24h,82h,0a4h,81h,64h,0feh
db 24h,80h,24h,80h,24h,0a0h,27h,0b0h
db 60h,1ch,20h,08h,00h,00h,00h,00h

end

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top