AD EQU 30H
RTR EQU 31H
LTR EQU 32H
STR EQU 33H
BW EQU 34H
BWS EQU 35H
SHW EQU 36H
SHWS EQU 37H
GW EQU 38H
GWS EQU 39H
WSHR EQU 3AHWSHR=BWS*100+SHWS*10+GWS
sz EQU 3BH数字与代码对应程序的数字变量
xsm EQU 3CH数字与代码对应程序的代码变量
TODH EQU 3DH计算的10进位数的高位*电机的要求转速高位
TODL EQU 3EH计算的10进位数的低位*电机的要求转速低位
TODHT EQU 3FH测试后电机的实际转速高位
TODLT EQU 40H测试后电机的实际转速低位
PCK EQU 41Hpc口当前的状态植
TOH EQU 42H定时器高位数
T0L EQU 43H定时器低位数
pink1 EQU 44H电机转动1/4圈定时器1的奇数次数
pink2 EQU 45H
VTIMES EQU 46H速度显示次数
T1H EQU 47H
T1L EQU 48H
TESTK DATA 49H 高电平脉冲的个数
TTH0 EQU 1AH
TTL0 EQU 4BH
SUBNOW EQU 4CH
ORG 0000H
LJMP MAIN
ORG 03H
AJMP INTR0中段0,用来计算电机转速
ORG 0BH
MOV A,PCK
ANL A,#00000111B
MOV PCK,A
MOV A,#00000110B
CJNE A,PCK,INTT0LF
LJMP INTT0L
ORG 1BHpwm停转子程序
AJMP INTT0H
ORG 0040H
**************************定时器中断子程序****************************
****电机停止程序
INTT0H:
mov th0,TOH
mov tl0,T0L
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
INC pink1
MOV DPTR,#7F02Hb地址
MOV A, #00000000B电机停止运动
MOVX @DPTR,A
reti
****电动机正转子程序
INTT0L:
mov th1,T1H
mov tl1,T1L
SETB TR1定时器1开始计数
CLR TR0定时器0禁止计数
MOV DPTR,#7F02Hb地址
MOV A, #11001100BC口输出片选号灯
MOVX @DPTR,A
reti
****电动机反转
INTT0LF:
mov th1,T1H
mov tl1,T1L
SETB TR1定时器1开始计数
CLR TR0定时器0禁止计数
MOV DPTR,#7F02Hb地址
MOV A, #10101100BC口输出片选号灯
MOVX @DPTR,A
reti
*************************计算电机转速************************
R2R3R4R5/ R6R7=R4R5余R2R3////(R2R3R4/R7)=(R2)R3R4 余数R7
INTR0:
MOV R2,#00H
MOV R3,#0EH
MOV R4,#0A6H
MOV R7,pink1
MOV pink1,#0
MOV A,#10
CLR CY
SUBB A,R7
JNB CY,OUTINT0
LCALL NDIV31
MOV TODHT, R3
MOV TODLT,R4
MOV R6,TODH
MOV R7,TODL
CLR CY
MOV A,R4
SUBB A,R7
MOV SUBNOW,A
JB CY,ADV
LCALL SUBV
JMP OUTINT0
ADV:
LCALL ADDV
OUTINT0:
LCALL JSW计算各位的数值毫时大大约600个始周期 MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
RETI***********************************************************************************************
***************************************************************************************************
***************************************************************************************************
COMP_M:
MOV A,#0FDH
SUBB A,TOH
JNB CY,OUT_PMM
MOV TOH,#0FDH
MOV T1H,#85
OUT_PMM:
RET
***************加速子程序**********************
ADDV:
CLR EA
CLR TR1
CLR TR0
MOV R1,SUBNOW
MOV R0,#10000000B
FRT:
MOV A,R0
RL A
MOV R0,A
MOV A,R1
ANL A,R0
JZ FRT
MOV A,TOH
ADD A,R0
JC VMAX
MOV TOH,A
MOV A,T1H
SUBB A,R0
MOV T1H,A
JMP TXT
VMAX:
MOV TOH,#0FDH
MOV T1H,#85
TXT:
SETB TR0
SETB TR1
SETB EA
RET
************减加速子程序*************************
SUBV:
CLR EA
CLR TR1
CLR TR0
MOV R1,SUBNOW
MOV R0,#10000000B
FRT1:
MOV A,R0
RL A
MOV R0,A
MOV A,R1
ANL A,R0
JZ FRT1
MOV A,TOH
SUBB A,R0
JC VMAX1
MOV TOH,A
MOV A,T1H
ADD A,R0
MOV T1H,A
JMP TXT1
VMAX1:
MOV TOH,#85
MOV T1H,#0FDH
TXT1:
SETB TR0
SETB TR1
SETB EA
RET
*****************************主程序**************************************
MAIN:
MOV BW,#7DH
MOV SHW,#7DH
MOV GW,#7DH
MOV BWS,#0
MOV SHWS,#0
MOV GWS,#0
MOV SP,#0A0H
MOV TOH,#0A1h******************************************************************
MOV T0L,#0h******************************************************************
MOV T1H,#0E1h*******************************************************************
MOV T1L,#37h*******************************************************************
MOV TMOD,#00H定时器0在模式1下工作
MOV RTR,#00110110B
MOV LTR,#00101101B
MOV PCK,#00H
MOV TODHT,#2
MOV TODLT,#25H
MOV TODH,#0
MOV TODL,#0
LCALL JSTIM计算总值TODH;TODL
MOV pink2,#0
MOV pink1,#0
SETB EX0
SETB IT0
START:
MOV DPTR,#7F00H状态字地址
MOV A, #00111111B设A,B,C口均为输出
MOVX @DPTR,A
LCALL DISPLAY显示
LCALL KEYSC扫描键盘
MOV TESTK,#44H************************************************TEST*************************************************
ACALL DISPKEYV 确定键盘
LCALL JSTIM计算总值TODH;TODL
LCALL JSW计算各位的数值毫时大大约600个始周期
LCALL JSEHW计算各个代码******************************
JMP START
*************************键盘扫描程序**************************
KEYSC:
MOV TESTK,#0
mov p1,#0FH p10-3输出1,作为输入位
mov a ,p1
ANL A,#0FH
CJNE A,#0FH,DELAY
RET
DELAY: ACALL DELAY1 延时去键抖
mov a ,p1
ANL A,#0FH
CJNE A,#0FH,HAVE
RET
HAVE:
MOV A,#0EFH 行扫描码
NEXT:
MOV B,A
MOV P1,A
MOV A,p1
ANL A,#0FH检测列
CJNE A,#0FH,YES
MOV A,B
RL A
CJNE A,#0FEH,NEXT
YES: orl a,#0f0h 高四位置1
CPL A
mov r2,#00h
MOV R2,A 存列码
MOV A,B 取行码,
CPL A
ORL A,R2 列码+行码=键植
MOV AD,#00H
MOV TESTK,A
RET
****************************确定键盘程序******************************
DISPKEYV:MOV A,TESTK
KEY0:CJNE A,#11H,KEY1
acall WORD0
KEY1:CJNE A,#12H,KEY2
acall WORD1
KEY2:CJNE A,#14H,KEY3
acall WORD2
KEY3:CJNE A,#18H,KEY4
acall WORD3
KEY4:CJNE A,#21H,KEY5
acall WORD4
KEY5:CJNE A,#22H,KEY6
acall WORD5
KEY6:CJNE A,#24H,KEY7
acall WORD6
KEY7:CJNE A,#28H,KEY8
acall WORD7
KEY8:CJNE A,#41H,KEY9
acall WORD8
KEY9:CJNE A,#42H,KEY10
acall WORD9
KEY10:CJNE A,#44H,KEY11
acall WORD10
KEY11:CJNE A,#48H,KEY12
acall WORD11
KEY12:CJNE A,#81H,KEY13
acall WORD12
KEY13:CJNE A,#82H,KEY14
acall WORD13
KEY14:CJNE A,#84H,KEY15
acall WORD14
KEY15:
CJNE A,#88H,PASS
AJMP WORD15
PASS:RET
WORD0:
lCALL MOVE
MOV A,#0
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK0:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT0
JMP TSTK0
OUT0:
MOV R0,#0
RET
WORD1:
lCALL MOVE
MOV A,#1
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK1:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT1
JMP TSTK1
OUT1:
MOV R0,#0
RET
WORD2:
lCALL MOVE
MOV A,#2
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK2:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT2
JMP TSTK2
OUT2:
MOV R0,#0
ACALL JSEHW计算各个位的显示代码
RET
WORD3:
lCALL MOVE
MOV A,#3
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK3:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT3
JMP TSTK3
OUT3:
MOV R0,#0
ACALL JSEHW计算各个位的显示代码
RET
WORD4:
lCALL MOVE
MOV A,#4
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK4:
LCALL KEYSC
CJNE A,TESTK,OUT4
JMP TSTK4
OUT4:
ACALL JSEHW计算各个位的显示代码
RET
WORD5:
lCALL MOVE
MOV A,#5
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK5:
LCALL KEYSC
CJNE A,TESTK,OUT5
JMP TSTK5
OUT5:
ACALL JSEHW计算各个位的显示代码
RET
WORD6:
lCALL MOVE
MOV A,#6
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK6:
LCALL KEYSC
CJNE A,TESTK,OUT6
JMP TSTK6
OUT6:
ACALL JSEHW计算各个位的显示代码
RET
WORD7:
lCALL MOVE
MOV A,#7
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK7:
LCALL KEYSC
CJNE A,TESTK,OUT7
JMP TSTK7
OUT7:
ACALL JSEHW计算各个位的显示代码
RET
WORD8:
lCALL MOVE
MOV A,#8
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK8:
LCALL KEYSC
CJNE A,TESTK,OUT8
JMP TSTK8
OUT8:
ACALL JSEHW计算各个位的显示代码
RET
WORD9:
lCALL MOVE
MOV A,#9
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK9:
LCALL KEYSC
CJNE A,TESTK,OUT9
JMP TSTK9
OUT9:
ACALL JSEHW计算各个位的显示代码
RET
WORD10:
CLR EA
CLR ET0
CLR TR0
mov th0,TOH
mov tl0,T0L
MOV PCK,#00000110B
SETB EA打开所有中断
SETB ET0定时器允许中断
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
SETB ET1定时器1允许中断
RET
WORD11:
CLR EA
CLR ET0
CLR TR0
mov th0,TOH
mov tl0,T0L
MOV PCK,#00000101B
SETB EA打开所有中断
SETB ET0定时器允许中断
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
SETB ET1定时器1允许中断
RET
WORD12:
LCALL ADDV
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
MOV A,TESTK
TSTK12:
LCALL KEYSC
CJNE A,TESTK,OUT12
JMP TSTK12
OUT12:
RET
WORD13:
LCALL SUBV
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
MOV A,TESTK
TSTK11:
LCALL KEYSC
CJNE A,TESTK,OUT11
JMP TSTK11
OUT11:
RET
WORD14:
CLR ET0使能定时器0中断
CLR ET1使能定时器1中断
CLR EA使能总中断
CLR TR1关闭T1计时
CLR TR0关闭T0计时
MOV PCK,#00H
MOV BW,#7DH
MOV SHW,#7DH
MOV GW,#77H
RET
WORD15:JB EA,MID15
MOV BWS,#0
MOV SHWS,#0
MOV GWS,#0
JMP OUT15
MID15:
CLR EA
MOV A,TESTK
TSTK15:
LCALL KEYSC
CJNE A,TESTK,OUT15
JMP TSTK15
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
OUT15:
SETB EA
RET
***********************计算各个代码******************************
JSEHW:
MOV SZ,BWS
ACALL js
MOV BW,xsm
MOV SZ,SHWS
ACALL js
MOV SHW,xsm
MOV SZ,GWS
ACALL js
MOV GW,xsm
RET
js:
mov a,sz
js0:cjne a,#0,js1
mov xsm,#7dh
js1:cjne a,#1,js2
mov xsm,#14h
js2:cjne a,#2,js3
mov xsm,#6eh
js3:cjne a,#3,js4
mov xsm,#3eh
js4:cjne a,#4,js5
mov xsm,#17h
js5:cjne a,#5,js6
mov xsm,#3bh
js6:cjne a,#6,js7
mov xsm,#7bh
js7:cjne a,#7,js8
mov xsm,#00011100B
js8:cjne a,#8,js9
mov xsm,#7fh
js9:cjne a,#9,js10
mov xsm,#3fh
js10:ret
***************************计算各位的数值毫时大大约600个始周期**************************************
JSW:(R2R3R4/R7)=(R2)R3R4 余数R7
MOV R2,#0
MOV R3,TODHT
MOV R4, TODLT
MOV R7,#100
LCALL NDIV31
MOV BWS,R4
MOV A,R7
MOV R4,A
MOV R3,#0
MOV R2,#0
MOV R7,#10
LCALL NDIV31
MOV SHWS,R4
MOV GWS,R7
RET
***************************计算十进制结果****************************
JSTIM:
MOV TODL,#0
MOV TODH,#0
MOV A,GWS
MOV B,#1
ACALL JSHL
MOV A,SHWS
MOV B,#10
ACALL JSHL
MOV A,BWS
MOV B,#100
ACALL JSHL
RET
JSHW:
JB OV,JSGW
CLR OV
RET
JSGW:
INC TODHTEST DATE
RET
JSHL:
MUL AB
MOV R1,B
ADD A,TODL
MOV TODL,A
MOV A,B
ADDC A,TODH
MOV TODH,A
ACALL JSHW
RET
*****************************单字节的除法*********************
****************************(R2R3R4/R7)=(R2)R3R4 余数R7
NDIV31 :MOVA,R2
MOVB,R7
DIVAB
MOVR2,B
MOVB,#10H
NDV311 :CLRC
MOVA,R4
RLCA
MOVR4,A
MOVA,R3
RLCA
MOVR3,A
MOVA,R2
RLCA
MOVR2,A
MOVF0,C
CLRC
SUBB A,R7
JB F0,NDV312
JC NDV313
NDV312 :MOVR2,A
INCR4
NDV313 :DJNZ B,NDV311
CLROV
JZ NDV314
SETB OV
NDV314 :XCHA,R2
MOVR7,A
RET
*******************双字节减法***(R3R4-R6R7)=(R3R4)*******
NSUB :MOVA,R4
CLRC
SUBB A,R7
MOVR4,A
MOVA,R3
SUBB A,R6
MOVR3,A
RET
DELAY1:
MOV R5,#10
D1: MOV R6,#250
DJNZ R6, $
DJNZ R5,D1
RET
DELAY_BS:
MOV R5,#5
D2: MOV R6,#99
D3: MOV R7,#99
DJNZ R7, $
DJNZ R6,D3
DJNZ R5,D2
RET
*****************************显示器显示子程序***********************************
DISPLAY:
MOV DPTR,#7F01H
MOV A, BW
MOVX @DPTR,A
MOV DPTR,#7F03Hc地址
MOV A, #00011000BC口输出片选号灯
MOV R0,PCKpck=********
ORL A,R0a=***11***
MOV R0,#00011111Ba=00011***
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
MOV DPTR,#7F01H
MOV A, SHW
MOVX @DPTR,A
MOV DPTR,#7F03Hc地址
MOV A,#00101000B
ORL A,R0
MOV R0,#00101111B
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
MOV DPTR,#7F01H
MOV A, GW
MOVX @DPTR,A
MOV DPTR,#7F03Hc地址
MOV A, #00110000BC口输出片选号灯
ORL A,R0
MOV R0,#00110111B
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
mov a,#0ffh
MOVX @DPTR,A
RET
D_40ms:
MOV R7,#10
DELAYBB:
MOV R6,#10
NOP
DELAYNN:
DJNZ R6,DELAYNN 2X198+2=398
DJNZ R7,DELAYBB (398+2)X200+1=80ms
RET
****************************各个位移位自程序***************************
MOVE:
MOV A,SHWS
MOV BWS,A
MOV A,GWS
MOV SHWS,A
RET
END
呵呵,用汇编的滑很复杂的。我有程序,不过和这个不是很对是我做的一个项目,你可利用参考下,AD EQU 30HRTR EQU 31H
LTR EQU 32H
STR EQU 33H
BW EQU 34H
BWS EQU 35H
SHW EQU 36H
SHWS EQU 37H
GW EQU 38H
GWS EQU 39H
WSHR EQU 3AHWSHR=BWS*100+SHWS*10+GWS
sz EQU 3BH数字与代码对应程序的数字变量
xsm EQU 3CH数字与代码对应程序的代码变量
TODH EQU 3DH计算的10进位数的高位*电机的要求转速高位
TODL EQU 3EH计算的10进位数的低位*电机的要求转速低位
TODHT EQU 3FH测试后电机的实际转速高位
TODLT EQU 40H测试后电机的实际转速低位
PCK EQU 41Hpc口当前的状态植
TOH EQU 42H定时器高位数
T0L EQU 43H定时器低位数
pink1 EQU 44H电机转动1/4圈定时器1的奇数次数
pink2 EQU 45H
VTIMES EQU 46H速度显示次数
T1H EQU 47H
T1L EQU 48H
TESTK DATA 49H 高电平脉冲的个数
TTH0 EQU 1AH
TTL0 EQU 4BH
SUBNOW EQU 4CH
ORG 0000H
LJMP MAIN
ORG 03H
AJMP INTR0中段0,用来计算电机转速
ORG 0BH
MOV A,PCK
ANL A,#00000111B
MOV PCK,A
MOV A,#00000110B
CJNE A,PCK,INTT0LF
LJMP INTT0L
ORG 1BHpwm停转子程序
AJMP INTT0H
ORG 0040H
**************************定时器中断子程序****************************
****电机停止程序
INTT0H:
mov th0,TOH
mov tl0,T0L
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
INC pink1
MOV DPTR,#7F02H b地址
MOV A, #00000000B电机停止运动
MOVX @DPTR,A
reti
****电动机正转子程序
INTT0L:
mov th1,T1H
mov tl1,T1L
SETB TR1定时器1开始计数
CLR TR0定时器0禁止计数
MOV DPTR,#7F02H b地址
MOV A, #11001100BC口输出片选号灯
MOVX @DPTR,A
reti
****电动机反转
INTT0LF:
mov th1,T1H
mov tl1,T1L
SETB TR1定时器1开始计数
CLR TR0定时器0禁止计数
MOV DPTR,#7F02H b地址
MOV A, #10101100BC口输出片选号灯
MOVX @DPTR,A
reti
*************************计算电机转速************************
R2R3R4R5/ R6R7=R4R5余R2R3////(R2R3R4/R7)=(R2)R3R4 余数R7
INTR0:
MOV R2,#00H
MOV R3,#0EH
MOV R4,#0A6H
MOV R7,pink1
MOV pink1,#0
MOV A,#10
CLR CY
SUBB A,R7
JNB CY,OUTINT0
LCALL NDIV31
MOV TODHT, R3
MOV TODLT,R4
MOV R6,TODH
MOV R7,TODL
CLR CY
MOV A,R4
SUBB A,R7
MOV SUBNOW,A
JB CY,ADV
LCALL SUBV
JMP OUTINT0
ADV:
LCALL ADDV
OUTINT0:
LCALL JSW计算各位的数值毫时大大约600个始周期 MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
RETI***********************************************************************************************
***************************************************************************************************
***************************************************************************************************
COMP_M:
MOV A,#0FDH
SUBB A,TOH
JNB CY,OUT_PMM
MOV TOH,#0FDH
MOV T1H,#85
OUT_PMM:
RET
***************加速子程序**********************
ADDV:
CLR EA
CLR TR1
CLR TR0
MOV R1,SUBNOW
MOV R0,#10000000B
FRT:
MOV A,R0
RL A
MOV R0,A
MOV A,R1
ANL A,R0
JZ FRT
MOV A,TOH
ADD A,R0
JC VMAX
MOV TOH,A
MOV A,T1H
SUBB A,R0
MOV T1H,A
JMP TXT
VMAX:
MOV TOH,#0FDH
MOV T1H,#85
TXT:
SETB TR0
SETB TR1
SETB EA
RET
************减加速子程序*************************
SUBV:
CLR EA
CLR TR1
CLR TR0
MOV R1,SUBNOW
MOV R0,#10000000B
FRT1:
MOV A,R0
RL A
MOV R0,A
MOV A,R1
ANL A,R0
JZ FRT1
MOV A,TOH
SUBB A,R0
JC VMAX1
MOV TOH,A
MOV A,T1H
ADD A,R0
MOV T1H,A
JMP TXT1
VMAX1:
MOV TOH,#85
MOV T1H,#0FDH
TXT1:
SETB TR0
SETB TR1
SETB EA
RET
*****************************主程序**************************************
MAIN:
MOV BW,#7DH
MOV SHW,#7DH
MOV GW,#7DH
MOV BWS,#0
MOV SHWS,#0
MOV GWS,#0
MOV SP,#0A0H
MOV TOH,#0A1h******************************************************************
MOV T0L,#0h******************************************************************
MOV T1H,#0E1h*******************************************************************
MOV T1L,#37h*******************************************************************
MOV TMOD,#00H定时器0在模式1下工作
MOV RTR,#00110110B
MOV LTR,#00101101B
MOV PCK,#00H
MOV TODHT,#2
MOV TODLT,#25H
MOV TODH,#0
MOV TODL,#0
LCALL JSTIM计算总值TODH;TODL
MOV pink2,#0
MOV pink1,#0
SETB EX0
SETB IT0
START:
MOV DPTR,#7F00H 状态字地址
MOV A, #00111111B设A,B,C口均为输出
MOVX @DPTR,A
LCALL DISPLAY显示
LCALL KEYSC扫描键盘
MOV TESTK,#44H************************************************TEST*************************************************
ACALL DISPKEYV 确定键盘
LCALL JSTIM计算总值TODH;TODL
LCALL JSW计算各位的数值毫时大大约600个始周期
LCALL JSEHW计算各个代码******************************
JMP START
*************************键盘扫描程序**************************
KEYSC:
MOV TESTK,#0
mov p1,#0FH p10-3输出1,作为输入位
mov a ,p1
ANL A,#0FH
CJNE A,#0FH,DELAY
RET
DELAY: ACALL DELAY1 延时去键抖
mov a ,p1
ANL A,#0FH
CJNE A,#0FH,HAVE
RET
HAVE:
MOV A,#0EFH 行扫描码
NEXT:
MOV B,A
MOV P1,A
MOV A,p1
ANL A,#0FH检测列
CJNE A,#0FH,YES
MOV A,B
RL A
CJNE A,#0FEH,NEXT
YES: orl a,#0f0h 高四位置1
CPL A
mov r2,#00h
MOV R2,A 存列码
MOV A,B 取行码,
CPL A
ORL A,R2 列码+行码=键植
MOV AD,#00H
MOV TESTK,A
RET
****************************确定键盘程序******************************
DISPKEYV:MOV A,TESTK
KEY0:CJNE A,#11H,KEY1
acall WORD0
KEY1:CJNE A,#12H,KEY2
acall WORD1
KEY2:CJNE A,#14H,KEY3
acall WORD2
KEY3:CJNE A,#18H,KEY4
acall WORD3
KEY4:CJNE A,#21H,KEY5
acall WORD4
KEY5:CJNE A,#22H,KEY6
acall WORD5
KEY6:CJNE A,#24H,KEY7
acall WORD6
KEY7:CJNE A,#28H,KEY8
acall WORD7
KEY8:CJNE A,#41H,KEY9
acall WORD8
KEY9:CJNE A,#42H,KEY10
acall WORD9
KEY10:CJNE A,#44H,KEY11
acall WORD10
KEY11:CJNE A,#48H,KEY12
acall WORD11
KEY12:CJNE A,#81H,KEY13
acall WORD12
KEY13:CJNE A,#82H,KEY14
acall WORD13
KEY14:CJNE A,#84H,KEY15
acall WORD14
KEY15:
CJNE A,#88H,PASS
AJMP WORD15
PASS:RET
WORD0:
lCALL MOVE
MOV A,#0
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK0:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT0
JMP TSTK0
OUT0:
MOV R0,#0
RET
WORD1:
lCALL MOVE
MOV A,#1
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK1:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT1
JMP TSTK1
OUT1:
MOV R0,#0
RET
WORD2:
lCALL MOVE
MOV A,#2
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK2:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT2
JMP TSTK2
OUT2:
MOV R0,#0
ACALL JSEHW计算各个位的显示代码
RET
WORD3:
lCALL MOVE
MOV A,#3
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV R0,TESTK
TSTK3:
LCALL KEYSC
MOV A,R0
CJNE A,TESTK,OUT3
JMP TSTK3
OUT3:
MOV R0,#0
ACALL JSEHW计算各个位的显示代码
RET
WORD4:
lCALL MOVE
MOV A,#4
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK4:
LCALL KEYSC
CJNE A,TESTK,OUT4
JMP TSTK4
OUT4:
ACALL JSEHW计算各个位的显示代码
RET
WORD5:
lCALL MOVE
MOV A,#5
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK5:
LCALL KEYSC
CJNE A,TESTK,OUT5
JMP TSTK5
OUT5:
ACALL JSEHW计算各个位的显示代码
RET
WORD6:
lCALL MOVE
MOV A,#6
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK6:
LCALL KEYSC
CJNE A,TESTK,OUT6
JMP TSTK6
OUT6:
ACALL JSEHW计算各个位的显示代码
RET
WORD7:
lCALL MOVE
MOV A,#7
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK7:
LCALL KEYSC
CJNE A,TESTK,OUT7
JMP TSTK7
OUT7:
ACALL JSEHW计算各个位的显示代码
RET
WORD8:
lCALL MOVE
MOV A,#8
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK8:
LCALL KEYSC
CJNE A,TESTK,OUT8
JMP TSTK8
OUT8:
ACALL JSEHW计算各个位的显示代码
RET
WORD9:
lCALL MOVE
MOV A,#9
MOV GWS,A
LCALL JSTIM计算总值TODH;TODL
MOV A,TESTK
TSTK9:
LCALL KEYSC
CJNE A,TESTK,OUT9
JMP TSTK9
OUT9:
ACALL JSEHW计算各个位的显示代码
RET
WORD10:
CLR EA
CLR ET0
CLR TR0
mov th0,TOH
mov tl0,T0L
MOV PCK,#00000110B
SETB EA打开所有中断
SETB ET0定时器允许中断
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
SETB ET1定时器1允许中断
RET
WORD11:
CLR EA
CLR ET0
CLR TR0
mov th0,TOH
mov tl0,T0L
MOV PCK,#00000101B
SETB EA打开所有中断
SETB ET0定时器允许中断
SETB TR0定时器0开始计数
CLR TR1定时器1禁止计数
SETB ET1定时器1允许中断
RET
WORD12:
LCALL ADDV
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
MOV A,TESTK
TSTK12:
LCALL KEYSC
CJNE A,TESTK,OUT12
JMP TSTK12
OUT12:
RET
WORD13:
LCALL SUBV
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
MOV A,TESTK
TSTK11:
LCALL KEYSC
CJNE A,TESTK,OUT11
JMP TSTK11
OUT11:
RET
WORD14:
CLR ET0使能定时器0中断
CLR ET1使能定时器1中断
CLR EA使能总中断
CLR TR1关闭T1计时
CLR TR0关闭T0计时
MOV PCK,#00H
MOV BW,#7DH
MOV SHW,#7DH
MOV GW,#77H
RET
WORD15:JB EA,MID15
MOV BWS,#0
MOV SHWS,#0
MOV GWS,#0
JMP OUT15
MID15:
CLR EA
MOV A,TESTK
TSTK15:
LCALL KEYSC
CJNE A,TESTK,OUT15
JMP TSTK15
MOV TODLT,TOH
LCALL JSW计算各位的数值毫时大大约600个始周期
OUT15:
SETB EA
RET
***********************计算各个代码******************************
JSEHW:
MOV SZ,BWS
ACALL js
MOV BW,xsm
MOV SZ,SHWS
ACALL js
MOV SHW,xsm
MOV SZ,GWS
ACALL js
MOV GW,xsm
RET
js:
mov a,sz
js0:cjne a,#0,js1
mov xsm,#7dh
js1:cjne a,#1,js2
mov xsm,#14h
js2:cjne a,#2,js3
mov xsm,#6eh
js3:cjne a,#3,js4
mov xsm,#3eh
js4:cjne a,#4,js5
mov xsm,#17h
js5:cjne a,#5,js6
mov xsm,#3bh
js6:cjne a,#6,js7
mov xsm,#7bh
js7:cjne a,#7,js8
mov xsm,#00011100B
js8:cjne a,#8,js9
mov xsm,#7fh
js9:cjne a,#9,js10
mov xsm,#3fh
js10:ret
***************************计算各位的数值毫时大大约600个始周期**************************************
JSW:(R2R3R4/R7)=(R2)R3R4 余数R7
MOV R2,#0
MOV R3,TODHT
MOV R4, TODLT
MOV R7,#100
LCALL NDIV31
MOV BWS,R4
MOV A,R7
MOV R4,A
MOV R3,#0
MOV R2,#0
MOV R7,#10
LCALL NDIV31
MOV SHWS,R4
MOV GWS,R7
RET
***************************计算十进制结果****************************
JSTIM:
MOV TODL,#0
MOV TODH,#0
MOV A,GWS
MOV B,#1
ACALL JSHL
MOV A,SHWS
MOV B,#10
ACALL JSHL
MOV A,BWS
MOV B,#100
ACALL JSHL
RET
JSHW:
JB OV,JSGW
CLR OV
RET
JSGW:
INC TODHTEST DATE
RET
JSHL:
MUL AB
MOV R1,B
ADD A,TODL
MOV TODL,A
MOV A,B
ADDC A,TODH
MOV TODH,A
ACALL JSHW
RET
*****************************单字节的除法*********************
****************************(R2R3R4/R7)=(R2)R3R4 余数R7
NDIV31 :MOVA,R2
MOVB,R7
DIVAB
MOVR2,B
MOVB,#10H
NDV311 :CLRC
MOVA,R4
RLCA
MOVR4,A
MOVA,R3
RLCA
MOVR3,A
MOVA,R2
RLCA
MOVR2,A
MOVF0,C
CLRC
SUBB A,R7
JB F0,NDV312
JC NDV313
NDV312 :MOVR2,A
INCR4
NDV313 :DJNZ B,NDV311
CLROV
JZ NDV314
SETB OV
NDV314 :XCHA,R2
MOVR7,A
RET
*******************双字节减法***(R3R4-R6R7)=(R3R4)*******
NSUB :MOVA,R4
CLRC
SUBB A,R7
MOVR4,A
MOVA,R3
SUBB A,R6
MOVR3,A
RET
DELAY1:
MOV R5,#10
D1: MOV R6,#250
DJNZ R6, $
DJNZ R5,D1
RET
DELAY_BS:
MOV R5,#5
D2: MOV R6,#99
D3: MOV R7,#99
DJNZ R7, $
DJNZ R6,D3
DJNZ R5,D2
RET
*****************************显示器显示子程序***********************************
DISPLAY:
MOV DPTR,#7F01H
MOV A, BW
MOVX @DPTR,A
MOV DPTR,#7F03H c地址
MOV A, #00011000BC口输出片选号灯
MOV R0,PCKpck=********
ORL A,R0a=***11***
MOV R0,#00011111Ba=00011***
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
MOV DPTR,#7F01H
MOV A, SHW
MOVX @DPTR,A
MOV DPTR,#7F03H c地址
MOV A,#00101000B
ORL A,R0
MOV R0,#00101111B
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
MOV DPTR,#7F01H
MOV A, GW
MOVX @DPTR,A
MOV DPTR,#7F03H c地址
MOV A, #00110000BC口输出片选号灯
ORL A,R0
MOV R0,#00110111B
ANL A,R0
MOVX @DPTR,A
ACALL D_40ms
mov a,#0ffh
MOVX @DPTR,A
RET
D_40ms:
MOV R7,#10
DELAYBB:
MOV R6,#10
NOP
DELAYNN:
DJNZ R6,DELAYNN 2X198+2=398
DJNZ R7,DELAYBB (398+2)X200+1=80ms
RET
****************************各个位移位自程序***************************
MOVE:
MOV A,SHWS
MOV BWS,A
MOV A,GWS
MOV SHWS,A
RET
END
这是红虎斑异国短毛猫。红虎斑异国短毛猫——加菲猫原形,属于波斯猫的一个分支,是为了那些喜欢波斯猫又懒得打理长毛的人而专门人工培育的。 加菲猫是短毛的波斯猫。
详细资料参见百度百科里的“红虎斑异国短毛猫”
http://baike.baidu.com/link?url=wZgmHoqe4OSuvtZnovo15QBAevGMNp-c0kgaD9r6-iaSTe4WPXje_rRBhs6jS9hEpL-CDWt8h8LVmo32FpdkLa