HOST_3: ;《《《智能》》》 MOV A,LCDDISPLAY ;回到主菜单 CJNE A,#0DH,HH_30 MOV DPTR,#TAB_H MOV MENU_RAM,#00H JMP MENUNEXT HH_30: MOV A,LCDDISPLAY CJNE A,#01H,HH_31 MOV DPTR,#TAB_31 MOV MENU_RAM,#0CH JMP MENUNEXT HH_31: CJNE A,#02H,HH_32 MOV DPTR,#TAB_32 MOV MENU_RAM,#0DH JMP MENUNEXT HH_32: CJNE A,#03H,HH_33 MOV DPTR,#TAB_33 MOV MENU_RAM,#0EH JMP MENUNEXT HH_33: CLR LCDDISPLAY CLR ONOFFLCD JMP LCD_LOOP HOST_4: ;《《《帮助》》》 MOV A,LCDDISPLAY ;回到主菜单 CJNE A,#0DH,HH_40 MOV DPTR,#TAB_H MOV MENU_RAM,#00H JMP MENUNEXT HH_40: MOV A,LCDDISPLAY CJNE A,#01H,HH_41 MOV DPTR,#TAB_41 MOV MENU_RAM,#0FH JMP MENUNEXT HH_41: CJNE A,#02H,HH_42 MOV DPTR,#TAB_42 MOV MENU_RAM,#10H JMP MENUNEXT HH_42: CJNE A,#03H,HH_43 MOV DPTR,#TAB_43 MOV MENU_RAM,#11H JMP MENUNEXT HH_43: CLR LCDDISPLAY CLR ONOFFLCD JMP LCD_LOOP ;----------------------------------------第二层菜单 HOST_11: MOV DPTR,#TAB_11 MOV MENU_RAM,#04H JMP MENUNEXT HOST_12: MOV DPTR,#TAB_12 MOV MENU_RAM,#04H JMP MENUNEXT HOST_13: MOV DPTR,#TAB_13 MOV MENU_RAM,#04H JMP MENUNEXT HOST_21: MOV DPTR,#TAB_21 MOV MENU_RAM,#07H JMP MENUNEXT HOST_22: MOV DPTR,#TAB_22 MOV MENU_RAM,#07H JMP MENUNEXT HOST_23: MOV DPTR,#TAB_23 MOV MENU_RAM,#07H JMP MENUNEXT HOST_31: MOV DPTR,#TAB_31 MOV MENU_RAM,#0AH JMP MENUNEXT HOST_32: MOV DPTR,#TAB_32 MOV MENU_RAM,#0AH JMP MENUNEXT HOST_33: MOV DPTR,#TAB_33 MOV MENU_RAM,#0AH JMP MENUNEXT HOST_41: MOV DPTR,#TAB_41 MOV MENU_RAM,#0DH JMP MENUNEXT HOST_42: MOV DPTR,#TAB_42 MOV MENU_RAM,#0DH JMP MENUNEXT HOST_43: MOV DPTR,#TAB_43 MOV MENU_RAM,#0DH JMP MENUNEXT ;------------------------------
;----------------------------显示内容 TAB_0: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB " 欢迎使用 ----------------家电中央控制系统自检中...... " TAB_H: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====主菜单项====3-智能 4-帮助1-控制 2-设置 " TAB_1: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====控制选项====2-控制全部从机 1-从机选择控制 3-更新从机联接 " TAB_2: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====设置选项====2-遥控设置 1-系统设置 3-时间设置 " TAB_3: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====智能选项====2-温度自动控制 1-编程自动控制 3-时间自动控制 " TAB_4: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====帮助选项====2-使用说明 1-系统自动检测 3-关于...... " TAB_11: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAA AA2AAAAAAAAAAAAA AA4AAAAAAAAAAAAAAA"----; DB "==从机选择控制==2- ",0FH,20H,"1- ",0FH,20H,"3- ",0FH,1FH TAB_12: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==控制全部从机==2-关闭全部从机 1-开启全部从机 共有从机 个 " TAB_13: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==更新从机联接== [执行]-开始更新更新从机状态报告 [取消]-退出更新" TAB_21: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====系统设置==== " TAB_22: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====遥控设置====1-设置遥控键值 16路遥控开关设置2-设置遥控对象 " TAB_23: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====时间设置====2005年09月06日 数字键入后按执行 22时33分 " TAB_31: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==编程自动控制== [执行]-打开串口通过电脑串口编程 [取消]-关闭串口 " TAB_32: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==温度自动控制== " TAB_33: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==时间自动控制== " TAB_41: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==系统自动检测== " TAB_42: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====使用说明====是由主机和多个从家电中央控制系统机组成的系统。",20H,1FH TAB_43: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....====统完全由杜洋自行本家电中央控制系开发,产权所有。" TAB_EORR: ;错误信息 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====系统错误====自检的错误!!!系统内部产生无法请断电后重新启动" TAB_NEW: ;新从机加入 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "==有新从机接入==统.... 有新的从机接入系从机ID号: " TAB_OUT: ;有从机断开 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====从机断开====已有1个从机断开 系统自检时发现--从机ID号: " TAB_ON: ;开启了某从机 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====从机开启==== 从机已经开启....从机ID号: " TAB_OFF: ;关闭了某从机 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_LIVE: ;自检报告显示 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_MESSAGE: ;系统状态信息 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_BESY: ;系统忙 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====系统忙碌====请耐心等候.... 系统正在内部处理----------------" TAB_ABOUT1: ;系统开发关于。。。 ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_ABOUT2: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_ABOUT3: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_NAME1: ;系统使用说明书 ;--"1AAAAAAAAAAAAAAA 3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "主机可以对任意",20H,1EH,"控制,并可以实现从机进行无线开关基本智能化控制",2EH,1FH TAB_NAME2: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB " " TAB_NAME3: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_NAME4: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_NAME5: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_NAME6: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_W1: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_W2: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_W3: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " TAB_W4: ;--"1AAAAAAAAAAAAAAA3AAAAAAAAAAAAAAA2AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA"----; DB "====关于....==== " ;---------------------------- START_LCD: MOV R1,#DIS1_RAM MOV R2,#0 START_LCD_1: MOV A,R2 MOVC A,@A+DPTR MOV @R1,A INC R2 INC R1 CJNE R2,#64,START_LCD_1 CALL LCD_DISPLAY RET ;------------------------------显示寄存器清空 CLR_RAM: MOV R0,#DIS1_RAM ;清共64个内存单元 MOV R7,#64 ; CLEARDISP: MOV @R0,#00H ; INC R0 ; DJNZ R7,CLEARDISP ; RET ;--------------------------------------------渐亮显示程序 LED_LOOP1: ; CLR A LED_LO1: CLR BACKLED INC A ;A加1,渐渐的增加亮的时间 CJNE A,#0FFH,E2 ;当最亮时跳出 E1: JMP LED_OVER1 ; E2: MOV R7,A ; D1: MOV R6,#10 ; D019: JNB LIN,LED_OVER1 DJNZ R6,D019 ; DJNZ R7,D1 ; SETB BACKLED ; JNB LIN,LED_OVER1 CPL A ;取反A MOV R7,A ; D2: MOV R6,#10 ; D029: JNB LIN,LED_OVER1 DJNZ R6,D029 ; DJNZ R7,D2 ; CPL A ;取回正A JMP LED_LO1 ; LED_OVER1: CLR BACKLED RET ;--------------------------------------------------渐暗子程序 LED_LOOP2: CLR A LED_LO2: SETB BACKLED INC A CJNE A,#0FFH,W2 W1: JMP LED_OVER2 W2: MOV R7,A D11: MOV R6,#10 D19: JNB LIN,LED_OVER2 DJNZ R6,D19 DJNZ R7,D11 CLR BACKLED JNB LIN,LED_OVER2 CPL A ;; MOV R7,A D22: MOV R6,#10 D29: JNB LIN,LED_OVER2 DJNZ R6,D29 DJNZ R7,D22 CPL A JMP LED_LO2 LED_OVER2: SETB BACKLED RET ;---------------------------------总线发射程序 LIN_T: CLR REDLED CLR EA CALL BB MOV R0,#LT_RAM MOV R2,#4 LINT00: ;放入数据表 MOV A,@R0 MOV R3,#8 LINT0: ;发射数据 RRC A JC LINT1 CALL B0 JMP LINT2 LINT1: CALL B1 LINT2: DJNZ R3,LINT0 INC R0 DJNZ R2,LINT00 LINTEXIT: ;退出发射 SETB LIN SETB EA SETB REDLED RET ;------------------------------------代码0、1发射子程序[底层] BB: ;初始化代码 CLR LIN CALL DL4500US RET B1: ;“1”的代码 SETB LIN CALL DL1120US CLR LIN CALL DL560US RET B0: ;“0”的代码 SETB LIN CALL DL560US CLR LIN CALL DL560US RET ;======================================T0中断处理 LED_T0: CLR EA JNB BACKLED,LED_T0_1 CALL LED_LOOP1 LED_T0_1: CLR BACKLED DJNZ T0_RAM,LEDT0_OUT CLR TR0 MOV T0_RAM,#250 CALL LED_LOOP2 LEDT0_OUT: MOV TL0,#0B0H ;50MS定时初值(T0计时用) MOV TH0,#3CH ;50MS定时初值 SETB EA RETI ;=========================================T0中断结束 ;=========================================总线中断处理(int0) LIN_INT0: CLR REDLED CLR EA ; PUSH PSW ; PUSH ACC MOV RR1,R1 ;将R1的值寄存保护起来 MOV RR3,#7 II0: ; CALL DL560US JB LIN,INTT0EXIT ; DJNZ RR3,II0 MOV R1,#LR_RAM ;数据载入地址及位数 AINN: ;读出数据包长度位 MOV RR3,#8 ;数据长度接收初定义 AINN0: JNB LIN,$ CALL DL882US MOV C,LIN JNC AINN1 CALL DL560US AINN1: ;数据放入寄存器 MOV A,@R1 RRC A MOV @R1,A DJNZ RR3,AINN0 MOV RR4,A INC R1 INN: ;数据包正文 MOV RR3,#8 INN0: JNB LIN,$ CALL DL882US MOV C,LIN JNC INN1 CALL DL560US INN1: ;数据放入寄存器 MOV A,@R1 RRC A MOV @R1,A DJNZ RR3,INN0 INC R1 DJNZ RR4,INN ;---------- CLR LCDDISPLAY SETB TR0 MOV A,LR_RAM+1 CJNE A,#03H,INTT0EXIT MOV LCDDISPLAY,LR_RAM+3 CPL XX2 SETB ONOFFLCD INTT0EXIT: ;退出接收 SETB LIN MOV T0_RAM,#250 MOV R1,RR1 ;还原主程序中R1的值 POP ACC POP PSW SETB EA SETB REDLED RETI ;=========================================中断结束 ;----------------------------液晶子程序 LCD_DISPLAY: CLR REDLED PPPP_1: MOV QR3_RAM,#30H CALL WRI MOV QR3_RAM,#0CH CALL WRI MOV QR3_RAM,#05H CALL WRI MOV QR3_RAM,#01H CALL WRI MOV QR3_RAM,#06H CALL WRI PPP_1: MOV R2,#64 MOV QR3_RAM,#80H CALL WRI MOV R0,#DIS1_RAM PPP_11: MOV A,@R0 MOV QR2_RAM,A CALL WRD INC R0 DJNZ R2,PPP_11 SETB REDLED RET ;-------------------------液晶写入子程序 ;写入"指令“子程序 WRI: PUSH ACC CLR RS SETB RW WRI_1: MOV LCDDAT,#0FFH SETB E MOV A,LCDDAT CLR E JB ACC.7,WRI_1 CLR RW MOV LCDDAT,QR3_RAM SETB E CLR E POP ACC RET ;写入"数据"子程序 WRD: PUSH ACC CLR RS SETB RW WRD_1: MOV LCDDAT,#0FFH SETB E MOV A,LCDDAT CLR E JB ACC.7,WRD_1 SETB RS CLR RW MOV LCDDAT,QR2_RAM SETB E CLR E POP ACC RET ;-----------------------------------------延时子程序 ;----------- DL882US: MOV R6,#20 D0: MOV R7,#20 DJNZ R7,$ DJNZ R6,D0 RET DL4500US: MOV R6,#10 DE1: MOV R7,#200 DJNZ R7,$ DJNZ R6,DE1 RET DL560US: MOV R6,#20 DE2: MOV R7,#12 DJNZ R7,$ DJNZ R6,DE2 RET DL1000US: MOV R6,#2 DE3:MOV R7,#248 DJNZ R7,$ DJNZ R6,DE3 RET DL9000US: CALL DL4500US CALL DL4500US RET DL1120US: CALL DL560US CALL DL560US RET DL20MS: ;20毫秒延时,主要用于去抖动。(100,100) MOV R6,#100 DL20MS_1: MOV R7,#100 DJNZ R7,$ DJNZ R6,DL20MS_1 RET DL60MS: ;60毫秒延时 CALL DL20MS CALL DL20MS CALL DL20MS RET DL1S: ;1秒延时,用在了开始等待。(50) MOV R5,#50 DL1S_1: CALL DL20MS DJNZ R5,DL1S_1 RET ;---------------------------------------结束 END