MOV NEW_TIME,#0
MOV KEY_ST,#0
MOV R4,#TOTA_ADDR ;从24C02读打铃时间点总数
MOV R0,#AL_TOTA
MOV R3,#1
ACALL RD_EEROM
MOV A,AL_TOTA ;总数大于0,小于、等于40判断
JZ JMP_RD
CLR C
SUBB A,#40
JC RD_AL_LIST
MOV AL_TOTA,#0
MOV R4,#TOTA_ADDR
MOV R3,#1
MOV R0,#AL_TOTA
ACALL WR_EEROM
SJMP JMP_RD
RD_AL_LIST:
MOV A,AL_TOTA ;从24C02读打铃时间表
RL A
MOV R3,A
;R0:RAM地址指针,R2:8位移位计数器
;R3:数据字节计数器
;R4:24C02 存储地址
MOV R0,#80H
MOV R4,#00H
ACALL RD_EEROM
JMP_RD: MOV TH2,#3CH ;T2工作方式、时间常数
MOV TL2 , #0ABH
MOV RCAP2H, #3CH
MOV RCAP2L, #0ABH
MOV T2CON , #04H
SETB ET2 ;开中断
SETB EA
WAITE: ACALL DISPLAY
ACALL KEY_CHECK
MOV A,KEY_ST
CJNE A,#00H,KEY_MAIN
MOV A,NEW_TIME
CJNE A,#0FFH,WAITE
MOV NEW_TIME,#0
NEW_DIS:
MOV A,H_MEM
ACALL HBCD
MOV DIS_MEM1,A
MOV A,M_MEM 毕业论文
http://www.751com.cn ACALL HBCD
MOV DIS_MEM2,A
MOV A,S_MEM
ACALL HBCD
MOV DIS_MEM3,A
ACALL DIS_TIME
MOV A,ALARM_ST
JNZ CHEK_OFF
MOV A,S_MEM
JNZ WAITE
ACALL CHEK_AL ;打铃检测
CHEK_OFF: MOV A,S_MEM
CLR C
SUBB A,#20
JC WAITE
CLR CONTREL
MOV ALARM_ST,#0
SJMP WAITE
;SJMP $
;********打铃控制子程序***************
CHEK_AL:MOV A,AL_TOTA
JZ CHEK_END
MOV R0,#80H
MOV R6,AL_TOTA
CHK_LOOP: MOV A,@R0
CJNE A,H_MEM,NEXT_AL_1
INC R0
MOV A,@R0
CJNE A,M_MEM,NEXT_AL_2
SETB CONTREL
MOV ALARM_ST,#0FFH
SJMP CHEK_END
NEXT_AL_1:INC R0
NEXT_AL_2:INC R0
DJNZ R6,CHK_LOOP
CLR CONTREL
MOV ALARM_ST,#0
CHEK_END:RET
;********键盘处理程序段***************
KEY_MAIN:
MOV KEY_ST,#0
JNB SET_TIME,TIME_SET
JNB SET_ALARM,JMP_SET_A
SJMP NEW_DIS
JMP_SET_A:AJMP ALARM_SET
;========时间设置=====================
TIME_SET:
MOV TIME_OVER,#30
MOV R5,H_MEM
MOV R6,M_MEM
MOV R7,S_MEM
SET_H: JNB FLASH_S,GATE_H
MOV DIS_MEM1,#0AAH
SJMP CLS_H
GATE_H: MOV A,R5
ACALL HBCD
MOV DIS_MEM1,A
MOV A,R6
ACALL HBCD
MOV DIS_MEM2,A
MOV A,R7
ACALL HBCD
MOV DIS_MEM3,A
CLS_H: ACALL DIS_TIME
ACALL DISPLAY
MOV A,NEW_TIME
CJNE A,#0FFH,JMP_1
MOV NEW_TIME,#0
DJNZ TIME_OVER,JMP_1
AJMP WAITE
JMP_1: ACALL KEY_CHECK
MOV A,KEY_ST
CJNE A,#0FFH,SET_H
MOV KEY_ST,#0
MOV TIME_OVER,#30
JNB UP,H_UP
JNB DOWN,H_DOWN
JNB LEFT,JMP_SET_S
JNB RIGHT,SET_M
JNB ESC,JMP_ESC
JNB ENTER,JMP_OK
SJMP SET_H
JMP_ESC:AJMP TIME_SET_ESC
JMP_OK: AJMP TIME_SET_OK
上一页 [1] [2] [3] [4] 下一页
单片机教学打铃控制器程序设计 第2页下载如图片无法显示或论文不完整,请联系qq752018766