仿真程序仿真:
1LED_0 EQU 30H LED_1 EQU 31H LED_2 EQU 32H ADC EQU 35H CNTA EQU 36HT TCNTB EQU 37H H_TEMP EQU 38H L_TEMP EQU 39H FLAG BIT 00H H_ALM BIT P3.0 L_ALM BIT P3.1 SOUND BIT P3.7 CLOCK BIT P2.4 ST BIT P2.5 EOC BIT P2.6 OE BIT P2.7 ORG 00H SJMP START ORG 0BH LJMP INT_T0
2ORG 1BH LJMP INT_T1 START:
MOV LED_0,#00H MOV LED_1,#00H MOV LED_2,#00H MOV DPTR,#TABLE MOV H_TEMP,#153 MOV L_TEMP,#77 MOV TMOD,#12H MOV TH0,#245 MOV TL0,#0
MOV TH1,#(65536-1000)/256 MOV TL1,#(65536-1000)/256 MOV IE,#8AH CLR C SETB TR0 WAIT:
SETB H_ALM SETB L_ALM CLR ST
3:SETB ST CLR ST JNB EOC,$ SETB OE MOV ADC,P1 CLR OE MOV A,ADC SUBB A,L_TEMP JC LALM MOV A,H_TEMP MOV R0,ADC SUBB A,R0 JC HALM CLR TR1 LJMP PROC1 LALM:CLR L_ALM SETB TR1 CLR FLAG LJMP PROC1 HALM:CLR H_ALM SETB TR1 SETB FLAG LJMP PROC1 PROC1:MOV A,ADC MOV B,#100 DIV AB MOV LED_2,A MOV A,B MOV B,#10 DIV AB MOV LED_1,A MOV LED_0,B LCALL DISP SJMP WAIT INT_T0:CPL CLOCK RETI INT_T1:MOV TH1,#(65536-1000)/256 MOV TL1,#(65536-1000)/256 CPL SOUND INC TCNTA MOV A,TCNTA JB FLAG,I1 CJNE A,#30,RETUNE SJMP I2
4:I1:CJNE A,#20,RETUNE I2:MOV TCNTA,#0 INC TCNTB MOV A,TCNTB CJNE A,#25,RETUNE MOV TCNTA,#0 MOV TCNTB,#0 LCALL DELAY2 RETUNE:RETI DISP:MOV A,LED_0 MOVC A,@A+DPTR CLR P2.3 MOV P0,A LCALL DELAY SETB P2.3 MOV A,LED_1 MOVC A,@A+DPTR CLR P2.2 MOV P0,A LCALL DELAY SETB P2.2 MOV A,LED_2 MOVC A,@A+DPTR CLR P2.1 MOV P0,A LCALL DELAY SETB P2.1 RET DELAY:MOV R6,#10 D1:MOV R7,#250 DJNZ R7,$ DJNZ R6,D1 RET DELAY2:MOV R5,#20 D2:MOV R6,#20 D3:MOV R7,#250 DJNZ R7,$ DJNZ R6,D3 DJNZ R5,D2 RET TABLE:DB 3FH,06H,5BH,4FH,66H DB 6DH,7DH,07H,7FH,6FH END
因篇幅问题不能全部显示,请点此查看更多更全内容