;接线方法:
;PA0~PA7接DB0~DB7,PC7接BUSY,PC0接REQ,CS8255选择CS0(0CFA0H)
;8255扩展OCMJ2X8模块测试程序
;------------------------------------------------
PA EQU 0CFA0H
PB EQU 0CFA1H
PCC EQU 0CFA2H
PCTL EQU 0CFA3H
STOBE0 EQU 70H ;PC0复位控制字
STOBE1 EQU 71H ;PC0置位控制字
CSEG AT 0000H
LJMP START
CSEG AT 4100H
;----------------------------------------
START: MOV DPTR, #PCTL
MOV A, #88H
MOVX @DPTR, A ;置PA口输出,PC口高4位输入,低4位输出
MOV DPTR, #PCTL
MOV A, #STOBE0
MOVX @DPTR, A
MOV A, #0F4H
ACALL SUB2
ACALL DELAY ;清屏
START1: MOV R0, #01H
MOV R1, #3CH
HE1: MOV DPTR, #PCC
MOVX A, @DPTR
JB ACC.7, HE1
ACALL SUB1
ACALL SUB2
DJNZ R1, HE1
ACALL DELAY
ACALL DELAY
ACALL DELAY
LJMP START1
;-------------------------------------------------------
DELAY: MOV R2, #23H
DEL0: MOV R4, #06FH
DEL1: MOV R6, #06FH
DEL2: DJNZ R6, DEL2
DJNZ R4, DEL1
DJNZ R2, DEL0
RET
;-------------------------------------------------------
SUB2: MOV DPTR, #PA
MOVX @DPTR, A
MOV DPTR, #PCTL
MOV A, #STOBE1
MOVX @DPTR, A
INC R0
HE2: MOV DPTR, #PCC
MOVX A, @DPTR
JNB ACC.7, HE2
MOV DPTR, #PCTL
MOV A, #STOBE0
MOVX @DPTR, A
RET
;-----------------------------------------
SUB1: MOV A, R0 ;显示“I LOVE YOU ”
MOVC A,@A+PC
RET
DB 0F0H,01D,00D,17D,17D,0F0H,02D,00D,30D,09D
DB 0F0H,03D,00D,32D,77D,0F0H,04D,00D,25D,04D
DB 0F0H,05D,00D,20D,79D,0F0H,06D,00D,42D,02D
DB 0F0H,01D,01D,31D,38D,0F0H,02D,01D,28D,28D
DB 0F0H,03D,01D,51D,48D,0F0H,04D,01D,47D,62D
DB 0F0H,05D,01D,25D,11D,0F0H,06D,01D,43D,30D
END
正文
8255扩展OCMJ2X8模块测试程序2005-08-23 21:21:00
【评论】 【打印】 【字体:大 中 小】 本文链接:http://blog.pfan.cn/niao0311/4092.html
阅读(2881) | 评论(0)
版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!
评论