;微波炉控制器源程序D8279EQU7FFEH;;定义A0=0地址AD8279EQU7FFFH;定义A0=1地址OUTBITP2.1;定义输出端STARTBIT3FH;定义开始工作标志位ORG0000HLJMPMAIN;主程序ORG0003HLJMPINT0;门状态ORG000BHLJMPTIME0ORG0013HLJMPINT1;按键中断程序入口ORG001BHLJMPTIME1;主程序ORG0030HMAIN:MOVSP,#55HCLROUT;输出功率为0SETBP2.6MOVTCON,#00H;INT0、INT1为边沿触发MOVTMOD,#11H;T0模式1,T1模式1MOVTH1,#3CH;?定时50msMOVTL1,#0B0HMOV50H,#3CHMOV51H,#0B0HMOVTH0,50H;?定时50msMOVTL0,50HMOV20H,#5MOVR7,20HMOV30H,#13H;初始显示全部为0MOV31H,#14HMOV32H,#15HMOV33H,#16HMOV34H,#13HMOV35H,#14HMOV36H,#15HMOV37H,#16HCLR46HCLR47HCLR4FHCLR50HCLR51HCLR52HSETBEACLRTR0CLRTR1CLR45HSETBET0SETBET1SETBEX1SETBEX0CLRSTARTMOV21H,#80HMOVDPTR,#AD8279;A0=1写入命令0MOVA,#0000H;从左边进入,2键互锁。MOVX@DPTR,AMOVA,#0D1HMOVX@DPTR,A;SETBTR1WAIT:MOVXA,@DPTRJBACC.7,WAITMOVA,#34H;写入命令1,CLK=2MHZ,N=20MOVX@DPTR,A;,内部工作频率为100khzMOVA,#90H;写显示RAM命令4,AI=1,RAM?地址自动加一LCALLDISP;调用显示程序LOOP:MOVA,21HJNBACC.7,KEY;acc.7作为标志位JNBSTART,LOOPJNB46H,GOTOCLR46HDJNZ41H,GOTOLJMPTRANKEY:MOV21H,#80HMOVB,#03HMOVDPTR,#FUNCLRCMULABJMP@A+DPTRGOTO:JB4FH,OPP;判断是否到达设定的点平保持时棘处于待机状态,循环调用鲜境绦?JNBOUT,GO1MOV52H,R5GO2:JNB47H,LOOP;判断是否计时到0CLR47HFIN:MOV70H,#5MOVR5,#1MOVR6,#1FIN1:MOV60H,#200MOVTH0,#0FCHMOVTL0,#18HMOV50H,#0FCHMOV51H,#18HMOV52H,#1SETBTR0SETBP2.6CH1:JNB4FH,$CPLP2.6CLR4FHDJNZ60H,CH1MOV60H,#100MOVTH0,#0F8HMOVTL0,#30HMOV50H,#0F8HMOV51H,#30HMOV52H,#1SETBTR0SETBP2.6CH2:JNB4FH,$CPLP2.6CLR4FHDJNZ60H,CH2DJNZ70H,FIN1CLRTR0MOV20H,#20CLRSTARTSETBP2.0SETBP2.1SETBP2.2SETBP2.3SETBP2.4SETBP2.5LJMPLOOPGO1:MOV52H,R6LJMPGO2OPP:CLR4FHCPLOUTLJMPLOOP;按键中断处理程序INT1:PUSHPSWPUSHACCMOVDPTR,#AD8279;写入命令2,读取FIFO/SENSORRAMMOVA,#40HMOVX@DPTR,AMOVDPTR,#D8279;读取FIFO/SENSORRAMMOVXA,@DPTRMOV21H,A;定义20H为键盘扫描内容的缓冲区POPACCPOPPSWRETI;开门中断;INT0:PUSHPSWPUSHACCSETBOUTCPLET0CPLET1CPLSTARTPOPACCPOPPSWRETI;分散转移处理程序FUN:LJMPKEY1LJMPKEY2LJMPKEY3LJMPKEY4LJMPKEY5LJMPKEY6LJMPKEY7LJMPKEY8LJMPKEY9LJMPKEY10LJMPKEY11LJMPKEY12LJMPKEY13LJMPKEY14LJMPKEY15;LJMPKEY16;各个键的功能程序;1、测试键KEY1:CLRSTARTSETB45HMOVR4,#5HMOVDPTR,#D8279MOVR3,#08HLOOP2:MOVA,#0FFHMOVX@DPTR,ADJNZR3,LOOP2GO0:MOVDPTR,#AD8279MOVA,#0A3H;命令5,显示写入禁止/消隐MOVX@DPTR,ALCALLDELAY1SMOVDPTR,#AD8279MOVA,#0A0HMOVX@DPTR,AMOVA,#90H;写显示RAM命令MOVX@DPTR,ALCALLDELAY1SDJNZR4,GO0LCALLDISPCLRTR1CLR45HLJMPLOOPDELAY1s:SETBTR1;延时1S;JNB46H,DELAY1S;定时是否到达1SCLR46HCLRTR1RET;2、火力1档KEY2:MOVR5,#04HMOVR6,#16MOV37H,#01SETBET0LCALLDISPLJMPLOOP;********************************************************;3、火力2档KEY3:MOVR5,#8MOVR6,#12MOV37H,#2SETBET0LCALLDISPLJMPLOOPTRAN:JB50H,KEY4JB51H,KEY3JB52H,KEY5;4、火力3档KEY4:MOVR5,#12MOVR6,#8MOV37H,#3SETBET0LCALLDISPLJMPLOOP;5、火力4档KEY5:MOVR5,#16MOVR6,#4MOV37H,#4SETBET0LCALLDISPLJMPLOOP;6、火力5档KEY6:MOV37H,#5SETBOUTLCALLDISPLJMPLOOP;7、时间加10分调整KEY7:INC30HMOVA,30HCJNEA,#0AH,qqMOV30H,#00Hqq:LCALLDISPLJMPLOOP;8、时间加1分调整KEY8:INC31HMOVA,31HCJNEA,#0AH,qq1MOV31H,#00Hqq1:LCALLDISPLJMPLOOP;9、时间加10秒调整KEY9:INC33HMOVA,33HCJNEA,#06H,qq3MOV33H,#00Hqq3:LCALLDISPLJMPLOOP;10、时间加1秒调整KEY10:MOV32H,0EHINC34HMOVA,34HCJNEA,#0AH,qq4MOV34H,#00Hqq4:LCALLDISPLJMPLOOP;11、开始工作键KEY11:CLRP2.0SETBTR0SETBTR1SETBSTARTSETBOUTLJMPLOOP;12、暂停/消除键KEY12:CPLTR0CPLTR1CLROUTCPLP2.0CPLSTARTLJMPLOOP;烹调键KEY13:SETB50HSETBP2.1CLRP2.2CLRP2.3MOV36H,#10MOV40H,#0MOV30H,#0MOV31H,#3MOV33H,#0MOV34H,#0MOV41H,#120LJMPKEY5;烘烤KEY14:SETB51HSETBP2.2CLRP2.1CLRP2.3MOV36H,#11MOV40H,#0MOV30H,#0MOV31H,#5MOV33H,#0MOV34H,#0MOV41H,#180LJMPKEY6;解冻KEY15:SETB52HSETBP2.3CLRP2.1CLRP2.2MOV36H,#12MOV40H,#0MOV30H,#0MOV31H,#1MOV33H,#0MOV34H,#0MOV41H,#90LJMPKEY4;定时器中断服务程序TIME1:PUSHPSWPUSHACCMOVTH1,#3CH;?定时50ms重新赋值MOVTL1,#0B0HDJNZR7,TT3MOVR7,20HSETB46HJB45H,TT3DEC34HMOVA,34HCJNEA,#0FFH,TT1DEC33HMOV34H,#9MOVA,33HCJNEA,#0FFH,TT1DEC31HMOV33H,#5MOV34H,#9MOVA,31HCJNEA,#0FFH,TT1DEC30HMOV31H,#9MOV33H,#5MOV34H,#9MOVA,30HCJNEA,#0FFH,TT1MOV30H,#00HMOV31H,#00HMOV33H,#00HMOV34H,#00HMOV35H,#00HMOV36H,#00HMOV37H,#00HCLRTR0CLRTR1CLROUTSETB47HTT1:LCALLDISPTT3:POPACCPOPPSWRETITIME0:PUSHPSWPUSHACCMOVTH0,50HMOVTL0,51HDJNZ52H,TT2SETB4FHJNBOUT,GO3MOV52H,R5LJMPTT2GO3:MOV52H,R6TT2:POPACCPOPPSWRETI;显示程序