|
一些51常用子程序,与大家分享
顺便问一下,这里有没有人用过新茂的ssu7301?我想用它来驱动液晶,程序如下:
LCDB4 EQU 0E5H
LCDB5 EQU 0E6H
LCDB6 EQU 0E7H
T_SEC EQU 40H ;0.1S ADDRESS
SEC EQU 41H ;THE ADDRESSES OF THE SYSTEM TIME
MIN EQU 43H
HOUR EQU 45H
ORG 0000H
AJMP MAIN
ORG 000BH ;INT0 DISTURB SERVICE USED AS WHEEL_PULSE
LJMP _INT0DIS
ORG 0100H
MAIN:
MOV TMOD,#01H ;T0 WORKS AT MODE 1
MOV TL0,#18H ;INITIAL FC18H
MOV TH0,#0FCH
MOV R7,#100 ;SET THE TIMES OF TO DISTURBS OCCOR IN R7
MOV IE,#10000010B ;EA _ _ ES ET1 EX1 ET0 EX0
SETB TR0
MOV LCDCON,#0E0H
MOV P0CON,#0FFH ;ENABLE I/O PORTS(P0[7:0]) FOR SEG[6:13] OUTPUT
MOV P2CON,#0FFH ;ENABLE I/0 PORTS(P2[7:0]) FOR SEG[3:0] AND COM[3:0] OUTPUT
MOV DPTR,#LCD_TAB
DISPLAY:
MOV A,T_SEC
MOVC A,@A+DPTR
MOV LCDB6,A
MOV A,SEC
MOV B,#10
DIV AB
MOV LCDB4,A
MOV A,B
MOV LCDB5,A
MOV A,MIN
MOV B,#10
DIV AB
MOV LCDB2,A
MOV A,B
MOV LCDB3,A
MOV A,HOUR
MOV B,#10
DIV AB
MOV LCDB0,A
MOV A,B
MOV LCDB1,A
LJMP DISPLAY
LCD_TAB:
DB 10111110B,00000110B,01111100B,01011110B ;FROM "0" TO "3"
DB 11000110B,11011010B,11111010B,00001110B ;FROM "4" TO "7"
DB 11111110B,11011110B ;FROM "8" TO "9"
_INT0DIS:
MOV TL0,#18H ;INITIAL FC18H
MOV TH0,#0FCH ;T0 WORKS AT MODE 1,1ms timer
DEC R7
MOV A,R7
JZ JMP_1
RETI
JMP_1:
MOV R7,#100 ;HERE 0.1S HAS PASSED , TAKE ACTION NOW
INC T_SEC ;T_SEC IS BINARY
MOV A,#10
XRL A,T_SEC
JZ JMP_2
RETI
JMP_2:
MOV T_SEC,#0
INC SEC ;SEC IS BINARY
MOV A,#60
XRL A,SEC
JZ JMP_3
RETI
JMP_3:
MOV SEC,#0
INC MIN ;MIN IS BINARY
MOV A,#60
XRL A,MIN
JZ JMP_4
RETI
JMP_4:
MOV MIN,#0
INC HOUR ;HOUR IS BINARY
RETI
END
就是一个计时然后显示出来,为什么不行呢?
ps:我是个初学者。
【文件名】:07616@52RD_常用子程序.rar
【格 式】:rar
【大 小】:2544K
【简 介】:
【目 录】:
[br]<p align=right><font color=red>+5 RD币</font></p> |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|