|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2006-10-20 20:09:53
|
显示全部楼层
这是一段家电控制上的汇编源程序,大家就悠着点看吧!眼睛痛不要找我啊!呵呵……
补充说明一点,是中颖的四位机,价格很便宜不超过4RMB。
;OSCILLATOR TYPE: Crystal oscillator
;WATCH DOG TIMER: Enable
;LVR VOLTAGE RAMGE:High LVR voltage
;OSCILLATOR RANGE:2~8MHZ
;LOW VOLTAGE RESET:Enable
;**********************************************
;*************************************
;SYSTEM REGISTER DEFINE
;*************************************
IE EQU 00H ;INTERRUPT ENABLE FLAG
IRQ EQU 01H ;INTERRUPT REQUEST
T0M EQU 02H ;TIMER O SET
T1M EQU 03H ;TIMER 1 SET
T0L EQU 04H
T0H EQU 05H
T1L EQU 06H
T1H EQU 07H
PORTA EQU 08H ;PORT A
PORTB EQU 09H
PORTC EQU 0AH
PORTD EQU 0BH
PORTE EQU 0CH
PORTF EQU 0DH
TBR EQU 0EH ;TABLE BRANCH REGISTER
INX EQU 0FH ;PSEUDO INDEX REGISTER
DPL EQU 10H ;DATA POINTER FOR INX LOW NIBBLE
DPM EQU 11H ;DATA POINTER FOR INX MIDDLE NIBBLE
DPH EQU 12H ;DATA POINTER FOR INX HIGH NIBBLE
CMP_CONTROL EQU 13H ;COMPARATOR CONTROL REGISTER
CMP_STATUS EQU 14H ;COMPARATOR SUATUS REGISTER
T2SET EQU 15H ;TIMER2 SET
PAOUT EQU 16H ;PORT A INPUT/OUTPUT SET
PBOUT EQU 17H
PCOUT EQU 18H
PDOUT EQU 19H
PEOUT EQU 1AH
PFOUT EQU 1BH
T2_SIGNAL_SET EQU 1CH ;TIMER2 EXTERNAL SIGNAL SOURCE SET
;1DH RESERVED
WDT EQU 1EH ;WATCH DOG TIMER
ROM_BANK EQU 1FH ;BANK REGISTER FOR ROM
PGOUT EQU 20H ;PORT G INPUT/OUTPUT SET
PHOUT EQU 21H ;PORT H INPUT/OUTPUT SET
PORTG EQU 22H ;PORTG
PORTH EQU 23H ;PORTH
PA_PULL_HIGH EQU 24H ;PORTA PULL-HIGH CONTROL
PB_PULL_HIGH EQU 25H ;PORTB PULL-HIGH CONTROL
PC_PULL_HIGH EQU 26H ;PORTC PULL-HIGH CONTROL
PD_PULL_HIGH EQU 27H ;PORTD PULL-HIGH CONTROL
PE_PULL_HIGH EQU 28H ;PORTE PULL-HIGH CONTROL
PF_PULL_HIGH EQU 29H ;PORTF PULL-HIGH CONTROL
PG_PULL_HIGH EQU 2AH ;PORTG PULL-HIGH CONTROL
PH_PULL_HIGH EQU 2BH ;PORTH PULL-HIGH CONTROL
TONE1_VOLUME_L EQU 2CH ;TONE GENERATOR 1 VOLUME LOW NIBBLE
TONE1_VOLUME_H EQU 2DH ;TONE GENERATOR 1 VOLUME HIGH NIBBLE
TONE2_VOLUME_L EQU 2EH ;TONE GENERATOR 2 VOLUME LOW NIBBLE
TONE2_VOLUME_H EQU 2FH ;TONE GENERATOR 2 VOLUME HIGH NIBBLE
RB7_RDT_L EQU 00H ;ROM DATA TABLE ADDRESS/DATA REGISTER LOW NIBBLE
RB7_RDT_ML EQU 01H ;ROM DATA TABLE ADDRESS/DATA REGISTER MIDDLE LOW NIBBLE
RB7_RDT_MH EQU 02H ;ROM DATA TABLE ADDRESS/DATA REGISTER MIDDLE HIGH NIBBLE
RB7_RDT_H EQU 03H ;ROM DATA TABLE ADDRESS/DATA REGISTER HIGH NIBBLE
RB7_T2L EQU 04H ;TIMER2 LOAD/COUNTER REGISTER(LOW NIBBLE)
RB7_T2ML EQU 05H ;TIMER2 LOAD/COUNTER REGISTER(MIDDLE LOW NIBBLE)
RB7_T2MH EQU 06H ;TIMER2 LOAD/COUNTER REGISTER(MIDDLE HIGH NIBBLE)
RB7_T2H EQU 07H ;TIMER2 LOAD/COUNTER REGISTER(HIGH NIBBLE)
RB7_TONE1_L EQU 08H ;TONE GENERATOR 1 LOW NIBBLE
RB7_TONE1_M EQU 09H ;TONE GENERATOR 1 MIDDLE NIBBLE
RB7_TONE1_H EQU 0AH ;TONE GENERATOR 1 HIGH NIBBLE
RB7_TONE2_L EQU 0BH ;TONE GENERATOR 2 LOW NIBBLE
RB7_TONE2_M EQU 0CH ;TONE GENERATOR 2 MIDDLE NIBBLE
RB7_TONE2_H EQU 0DH ;TONE GENERATOR 2 HIGH NIBBLE
RB7_T2_PRE EQU 0EH ;TIMER2 PRE-SCALER REGISTER
RB7_COMPARATOR_SET EQU 0FH ;COMPARATOR CHANNEL SELECT & COMPARATOR OUTPUT DATA
RB7_PF_IE_FLAG EQU 10H ;PORTF INTERRUPT ENABLE FLAGS
RB7_PG_IE_FLAG EQU 11H ;PORTG INTERRUPT ENABLE FLAGS
RB7_PF_IRQ_FLAG EQU 12H ;PORTF INTERRUPT REQUEST FLAGS
RB7_PG_IRQ_FLAG EQU 13H ;PORTG INTERRUPT REQUEST FLAGS
RB7_CMP_IE_IRQ_F EQU 14H ;CMP INTERRUPT ENABLE FLAG
;***************************************
;DATA MEMORY DEFINE
;***************************************
;-------------BANK 0--------------------
ACC EQU 30H
;PROTECT ACCUMULATER REGISTER(ONLY TIMER0 USED)
TEMP EQU 31H
;TEMP REGISTER
CLRACC EQU 32H
;CLEAR ACCUMULATER USED REGISTER
RELAY_FLAG EQU 33H
;BIT0:BUZZER OUTPUT FLAG
;BIT1:WAVE OUTPUT FLAG
;BIT2:GRILL OUTPUT FLAG
;BIT3:LIGHT OUTPUT FLAG
MACHINE_TYPE EQU 34H
;MACHINE TYPE REGISTER
GRILL_CT0 EQU 35H
GRILL_CT1 EQU 36H
GRILL_CT2 EQU 37H
;GRILL WORK TIME TIMER USED REGISTERS
LONG_PRESS_EACH_CT EQU 38H
;LONG PRESS EACH TIME COUTER 0(BASE ON 12.25MS KEY SCAN TIMER)
TEMP_M EQU 39H
;MACRO PART USED TEMP REGISTER
TIMER_CLOCK_CT0 EQU 3AH
TIMER_CLOCK_CT1 EQU 3BH
TIMER_CLOCK_CT2 EQU 3CH
TIMER_CLOCK_CT3 EQU 3DH
TIMER_CLOCK_CT4 EQU 3EH
TIMER_CLOCK_CT5 EQU 3FH
;CLOCK TIMER USED REGISTERS
TIMER_5MIN_CT0 EQU 40H
;WORK TIME LONGER(EQUAL) THAN 5 MINUTES TIMER USED REGISTER 0
TIMER_5MIN_CT1 EQU 41H
;WORK TIME LONGER(EQUAL) THAN 5 MINUTES TIMER USED REGISTER 0
TIMER_5MIN_CT2 EQU 42H
;WORK TIME LONGER(EQUAL) THAN 5 MINUTES TIMER USED REGISTER 0
DEFROST_P EQU 43H
;DEFROST PERIOD REGISTER
TEMP_R0 EQU 44H
;TEMP REGISTER 0
TEMP_R1 EQU 45H
;TEMP REGISTER 1
TEMP_R2 EQU 46H
;TEMP REGISTER 2
TEMP_R3 EQU 47H
;TEMP REGISTER 3
TEMP_R4 EQU 48H
;TEMP REGISTER 4
TEMP_R5 EQU 49H
;TEMP REGISTER 5
TEMP_R6 EQU 4AH
;TEMP REGISTER 6
WORK_TYPE EQU 4BH
;00H:NOT WORK TYPE 01H:CLOCK TYPE 02H:PRESET TYPE 03H:MICRO TYPE
;04H:FAST COOK TYPE 05H:DEFROST 06H:GRILL COMBI TYPE 07H:AUTO COOK TYPE
;08H:NO GRILL,FAST COOK 09H:CHILD LOCK 0AH:NOT USED 0BH:NOT USED
;0CH:NOT USED 0DH:NOT USED 0EH:NOT USED 0FH:COOK FINISH TYPE
KEY_VALUE EQU 4CH
;ONE REAL KEY VALUE
KEY_VALUEH EQU 4DH
;WORK TYPE NUMBER HIGH NIBBLE
KEY_VALUEL EQU 4EH
;WORK TYPE NUMBER LOW NIBBLE
CODING_VALUEH EQU 4FH
;CODING VALUE HIGH NIBBLE
CODING_VALUEL EQU 50H
;CODING VALUE LOW NIBBLE
RELAY_ON_TIMEH EQU 51H
;WAVE/GRILL/ RELAY ON TIME HIGH NIBBLE
RELAY_ON_TIMEL EQU 52H
;WAVE/GRILL RELAY ON TIME LOW NIBBLE
KEY_LS EQU 53H
;0CH:CHILD LOCK KEY
;0EH:NO KEY 0FH:KEY ALREADY PROCESS
BUZZER_TYPE EQU 54H
;BUZZER TYPE REGISTER
BUZZER_TIMES EQU 55H
;BUZZER DEGREE REGISTER
DOOR_T EQU 56H
;SCAN KEY TIMES
KEY_T EQU 57H
;KEY SCAN TIMES
DISPLAY_BIT EQU 58H
;DISPLAY BIT REGISTER
LEVEL EQU 59H
;MICROWAVE/AUTOFUNCTION LEVEL REGISTER
AUTO_CONFIRM_CT EQU 5AH
;CLOCK AUTO CONFIRM TIMER USED REGISTER(BASED ON 500MS)
WORK_MINH EQU 5BH
;WORK TIME NINUTE HIGH NIBBLE
WORK_MINL EQU 5CH
;WORK TIME MINUTE LOW NIBBLE
WORK_SECH EQU 5DH
;WORK TIME SECOND HIGH NIBBLE
WORK_SECL EQU 5EH
;WORK TIME SECOND LOW NIBBLE
TIME_HORH EQU 5FH
;CLOCK HOUR HIGH NIBBLE
TIME_HORL EQU 60H
;CLOCK HOUR LOW NIBBLE
TIME_MINH EQU 61H
;CLOCK MINUTE HIGH NIBBLE
TIME_MINL EQU 62H
;CLOCK MINUTE LOW NIBBLE
PRE_TIME_MINH EQU 63H
;PRESET TIME MINUTE HIGH NIBBLE
PRE_TIME_MINL EQU 64H
;PRESET TIME MINUTE LOW NIBBLE
PRE_TIME_HORH EQU 65H
;PRESET TIME HOUR HIGH NIBBLE
PRE_TIME_HORL EQU 66H
;PRESET TIME HOUR LOW NIBBLE
WORK_FLAG8 EQU 67H
;BIT0:set_timer
;BIT1:auto_start
;BIT2:DURING KEY SCAN FLAG
;BIT3:POWER ON ALL LED ON FLAG
WORK_FLAG0 EQU 68H
;BIT0:LOOK POWER FLAG
;BIT1:1S DISPLAY RAY FLAG
;BIT2:500MS TIMER FLAG
;BIT3:500MS DISPLAY RAY FLAG
WORK_FLAG1 EQU 69H
;BIT0:START KEY INVILID FLAG
;BIT1:1S TIMER FLAG
;BIT2:50MS LONG PRESS KEY EACH FLAG
;BIT3:CLOCK ALREADY SET FLAG
WORK_FLAG2 EQU 6AH
;BIT0:CODE SWITCH IS "01"
;BIT1:CODE SWITCH IS "10"
;BIT2:CODE SWITCH DISABLE FLAG
;BIT3:5MS SCAN KEY FLAG
WORK_FLAG3 EQU 6BH
;BIT0:CHECK PRESET CLOCK CHECK
;BIT1:WORK START FLAG
;BIT2:WORK PAUSE FLAG
;BIT3:DOOR OPEN FLAG
WORK_FLAG4 EQU 6CH
;BIT0:SET TIME
;BIT1:run_timer
;BIT2:PRESET FLAG
;BIT3:LONG PRESS KEY ON FLAG
WORK_FLAG7 EQU 6DH
;BIT0:GRILL TYPE FLAG
;BIT1:TIMER1S
;BIT2:set_clock_start
;BIT3:LOCK_FIRST
NOW_COOK_TYPE_L EQU 6EH
;NOW COOK TYPE REGISTER LOW NIBBLE
CS_BUFFER EQU 70H
;CODDING SWITCH LAST STATE REGISTER
POWER_ON_LCD_ON_TIMER EQU 71H
;POWER ON LCE ON TIMER USED REGISTER(BASED ON 500MS)
TIMER_KEY_CT0 EQU 72H
;SCAN KEY TIMER USED REGISTER 0
TIMER_KEY_CT1 EQU 73H
;SCAN KEY TIMER USED REGISTER 1
TIMER_RAY_CT0 EQU 74H
;DISPLAY PART RAY TIMER USED REGISTER 0
TIMER_RAY_CT1 EQU 75H
;DISPLAY PART RAY TIMER USED REGISTER 1
TIMER_RAY_CT2 EQU 76H
;DISPLAY PART RAY TIMER USED REGISTER 2
TIMER_CODE_CT EQU 77H
;CODDING SWITCH SCAN TIMER USED REGISTER
TIMER_WT_CT0 EQU 78H
;WORK TIME TIEMR USED REGISTER 0
TIMER_WT_CT1 EQU 79H
;WORK TIME TIEMR USED REGISTER 1
TIMER_WT_CT2 EQU 7AH
;WORK TIME TIEMR USED REGISTER 2
TIMER_WT_CT3 EQU 7BH
;WORK TIME TIMER USED REGISTER 3
DIS_DATA_BUFFER_L EQU 7CH
;DISPLAY DATA BUFFER LOW NIBBLE
DIS_DATA_BUFFER_H EQU 7DH
;DISPLAY DATA BUFFER HIGH NIBBLE
TIMER_DIS_CT EQU 7EH
;DISPLAY TIMER USED REGISTER
SET_STATE EQU 7FH
;MICRO WAVE/GRILL/COMBI SET STATE(SOFT KEY MACHINE)
;------------------------------------------
;----------RAM BANK 1(80H--FFH)------------
;------------------------------------------
MUL_WORK_MINH1 EQU 00H
;MUL COOK WORK TIME MINUTE HIGH BANK 1
MUL_WORK_MINL1 EQU 01H
;MUL COOK WORK TIME MINUTE LOW BANK 1
MUL_WORK_SECH1 EQU 02H
;MUL COOK WORK TIME SECOND HIGH BANK 1
MUL_WORK_SECL1 EQU 03H
;MUL COOK WORK TIME SECOND LOW BANK 1
MUL_WORK_MINH3 EQU 08H
;MUL COOK WORK TIME MINUTE HIGH BANK 3
MUL_WORK_MINL3 EQU 09H
;MUL COOK WORK TIME MINUTE LOW BANK 3
MUL_WORK_SECH3 EQU 0AH
;MUL COOK WORK TIME SECOND HIGH BANK 3
MUL_WORK_SECL3 EQU 0BH
;MUL COOK WORK TIME SECOND LOW BANK 3
MUL_WORK_MINH4 EQU 0CH
;MUL COOK WORK TIME MINUTE HIGH BANK 4
MUL_WORK_MINL4 EQU 0DH
;MUL COOK WORK TIME MINUTE LOW BANK 4
MUL_WORK_SECH4 EQU 0EH
;MUL COOK WORK TIME SECOND HIGH BANK 4
MUL_WORK_SECL4 EQU 0FH
;MUL COOK WORK TIME SECOND LOW BANK 4
MUL_COOK_TYPE4H EQU 10H
;MUL COOK TYPE BANK 4 HIGH NIBBLE
MUL_COOK_TYPE4L EQU 11H
;MUL COOK TYPE BANK 4 LOW NIBBLE
MUL_COOK_TYPE3L EQU 12H
;MUL COOK TYPE BANK 3 LOW NIBBLE
MUL_COOK_TYPE3H EQU 13H
;MUL COOK TYPE BANK 3 HIGH NIBBLE
MUL_COOK_TYPE2L EQU 14H
;MUL COOK TYPE BANK 2 LOW NIBBLE
MUL_COOK_TYPE2H EQU 15H
;MUL COOK TYPE BANK 2 HIGH NIBBLE
MUL_COOK_TYPE1L EQU 16H
;MUL COOK TYPE BANK 1 LOW NIBBLE
MUL_COOK_TYPE1H EQU 17H
;MUL COOK TYPE BANK 1 HIGH NIBBLE
RB1_TIMER_BUZ_CT0 EQU 18H
;BUZZER TIME TIMER USED REGISTER 0
RB1_TIMER_BUZ_CT1 EQU 19H
;BUZZER TIME TIMER USED REGISTER 1
RB1_TIMER_BUZ_CT2 EQU 1AH
;BUZZER TIME TIMER USED REGISTER 2
RB1_TIMER_BUZ_CT3 EQU 1BH
;BUZZER TIME TIMER USED REGISTER 3
RB1_TIMER_SHARE_CT0 EQU 1CH
;LOOK STATE/CHILDLOCK TIMER USED REGISTER 0
RB1_TIMER_SHARE_CT1 EQU 1DH
;LOOK STATE/CHILDLOCK TIMER USED REGISTER 1
RB1_TIMER_SHARE_CT2 EQU 1EH
;LOOK STATE/CHILDLOCK TIMER USED REGISTER 2
RB1_TIMER_SHARE_CT3 EQU 1FH
;LOOK STATE/CHILDLOCK TIMER USED REGISTER 3
DEFROST_CT0 EQU 20H
;DEFROST 1/4 TIME 0.1 SECOND BIT NIBBLE
DEFROST_CT1 EQU 21H
;DEFROST 1/4 TIME SECOND BIT LOW NIBBLE
DEFROST_CT2 EQU 22H
;DEFROST 1/4 TIME SECOND BIT HIGH NIBBLE
DEFROST_CT3 EQU 23H
;DEFROST 1/4 TIME MINUTE BIT NIBBLE
DISPLAY_VALUE EQU 24H
;DISPLAY VAULE
RB1_DOOR_OPEN_CT3 EQU 25H
;500MS TIMER USED REGISTER
RB1_DOOR_OPEN_CT4 EQU 26H
;500MS TIMER USED REGISTER
RB1_DOOR_OPEN_CT5 EQU 27H
;500MS TIMER USED REGISTER
RB1_OPTION_PE_LAST EQU 2AH
RB1_OPTION_PC_LAST EQU 2BH
;MACHINE TYPE OPTION LAST STATE
RB1_GET_OPTION_TIME EQU 2CH
;MACHINE TYPE OPTION CHECK TIMES
DIS_LINE1H EQU 30H
;DISPLAY PART:LINE1 HIGH PART NIBBLE
DIS_LINE1L EQU 31H
;DISPLAY PART:LINE1 LOW PART NIBBLE
DIS_LINE2H EQU 32H
;DISPLAY PART:LINE2 HIGH PART NIBBLE
DIS_LINE2L EQU 33H
;DISPLAY PART:LINE2 LOW PART NIBBLE
DIS_LINE3H EQU 34H
;DISPLAY PART:LINE3 HIGH PART NIBBLE
DIS_LINE3L EQU 35H
;DISPLAY PART:LINE3 LOW PART NIBBLE
DIS_LINE4H EQU 36H
;DISPLAY PART:LINE4 HIGH PART NIBBLE
DIS_LINE4L EQU 37H
;DISPLAY PART:LINE4 LOW PART NIBBLE
DIS_LINE5H EQU 38H
;DISPLAY PART:LINE5 HIGH PART NIBBLE
DIS_LINE5L EQU 39H
;DISPLAY PART:LINE5 LOW PART NIBBLE
DIS_LINE6H EQU 3AH
;DISPLAY PART:LINE6 HIGH PART NIBBLE
DIS_LINE6L EQU 3BH
;DISPLAY PART:LINE7 LOW PART NIBBLE
DEF_AUTO EQU 3CH
RB1_END_CT0 EQU 40H
;AFTER COOK END,3 MINUTES TIMER USED REGISTER 0
RB1_END_CT1 EQU 41H
;AFTER COOK END,3 MINUTES TIMER USED REGISTER 1
RB1_END_CT2 EQU 42H
;AFTER COOK END,3 MINUTES TIMER USED REGISTER 2
RB1_RELAY_CHANGE_CT0 EQU 43H
;RELAY CHANGE DELAY 100MS TIMER USED REGISTER
RB1_RELAY_CHANGE_CT1 EQU 44H
;RELAY CHANGE DELAY 100MS TIMER USED REGISTER
RB1_RELAY_CHANGE_CT2 EQU 45H
;RELAY CHANGE DELAY 100MS TIMER USED REGISTER
AUTO_CANCEL_CT0 EQU 48H
;PRESET CLOCK 10SECONDS CANCEL REGISTER(BASED ON 500MS)
AUTO_CANCEL_CT1 EQU 49H
;PRESET CLOCK 10SECONDS CANCEL REGISTER(BASED ON 500MS)
LONG_PRESS_TIME_CT EQU 4AH
;LONG PRESS KEY TIMER USED COUNTER(BASED ON 500MS)
LONG_PRESS_EACH_CT1 EQU 4BH
;LONG PRESS KEY TIMER USED COUNTER(BASED ON 500MS)
START_2_MINUTES_CT0 EQU 4CH
;START KEY 2 MINUTES NOT VILID TIMER USED REGISTER(BASED ON 500MS)
START_2_MINUTES_CT1 EQU 4DH
;START KEY 2 MINUTES NOT VILID TIMER USED REGISTER(BASED ON 500MS)
TIMER_NOTON_CT0 EQU 50H
;SET FUNCTION & NOT START TIMER USED REGISTER 0(BASED ON 500MS)
TIMER_NOTON_CT1 EQU 51H
;SET FUNCTION & NOT START TIMER USED REGISTER 1(BASED ON 500MS)
TIMER_NOTON_CT2 EQU 52H
;SET FUNCTION & NOT START TIMER USED REGISTER 2(BASED ON 500MS)
LINE1_CURRENT_DATA_B EQU 60H
;THE FIRST LINE KEY CURRENT NIBBLE(PORTB)
LINE1_CURRENT_DATA_D EQU 61H
;THE FIRST LINE KEY CURRENT NIBBLE(PORTD)
LINE1_CURRENT_DATA_H EQU 62H
;THE FIRST LINE KEY CURRENT NIBBLE(PORTH)
LINE2_CURRENT_DATA_B EQU 63H
;THE SECOND LINE KEY CURRENT NIBBLE(PORTB)
LINE2_CURRENT_DATA_D EQU 64H
;THE SECOND LINE KEY CURRENT NIBBLE(PORTD)
LINE2_CURRENT_DATA_H EQU 65H
;THE SECOND LINE KEY CURRENT NIBBLE(PORTH)
LINE3_CURRENT_DATA_B EQU 66H
;THE THIRD LINE KEY CURRENT NIBBLE(PORTB)
LINE3_CURRENT_DATA_D EQU 67H
;THE THIRD LINE KEY CURRENT NIBBLE(PORTD)
LINE3_CURRENT_DATA_H EQU 68H
;THE THIRD LINE KEY CURRENT NIBBLE(PORTH)
LINE4_CURRENT_DATA_B EQU 69H
;THE FOURTH LINE KEY CURRENT NIBBLE(PORTB)
LINE4_CURRENT_DATA_D EQU 6AH
;THE FOURTH LINE KEY CURRENT NIBBLE(PORTD)
LINE4_CURRENT_DATA_H EQU 6BH
;THE FOURTH LINE KEY CURRENT NIBBLE(PORTH)
LINE5_CURRENT_DATA_B EQU 6CH
;THE FIFTH LINE KEY CURRENT NIBBLE(PORTB)
LINE5_CURRENT_DATA_D EQU 6DH
;THE FIFTH LINE KEY CURRENT NIBBLE(PORTD)
LINE5_CURRENT_DATA_H EQU 6EH
;THE FIFTH LINE KEY CURRENT NIBBLE(PORTH)
LINE1_LAST_DATA_B EQU 70H
;THE FIRST LINE KEY LAST NIBBLE(PORTB)
LINE1_LAST_DATA_D EQU 71H
;THE FIRST LINE KEY LAST NIBBLE(PORTD)
LINE1_LAST_DATA_H EQU 72H
;THE FIRST LINE KEY LAST NIBBLE(PORTH)
LINE2_LAST_DATA_B EQU 73H
;THE SECOND LINE KEY LAST NIBBLE(PORTB)
LINE2_LAST_DATA_D EQU 74H
;THE SECOND LINE KEY LAST NIBBLE(PORTD)
LINE2_LAST_DATA_H EQU 75H
;THE SECOND LINE KEY LAST NIBBLE(PORTH)
LINE3_LAST_DATA_B EQU 76H
;THE THIRD LINE KEY LAST NIBBLE(PORTB)
LINE3_LAST_DATA_D EQU 77H
;THE THIRD LINE KEY LAST NIBBLE(PORTD)
LINE3_LAST_DATA_H EQU 78H
;THE THIRD LINE KEY LAST NIBBLE(PORTH)
LINE4_LAST_DATA_B EQU 79H
;THE FOURTH LINE KEY LAST NIBBLE(PORTB)
LINE4_LAST_DATA_D EQU 7AH
;THE FOURTH LINE KEY LAST NIBBLE(PORTD)
LINE4_LAST_DATA_H EQU 7BH
;THE FOURTH LINE KEY LAST NIBBLE(PORTH)
LINE5_LAST_DATA_B EQU 7CH
;THE FIFTH LINE KEY LAST NIBBLE(PORTB)
LINE5_LAST_DATA_D EQU 7DH
;THE FIFTH LINE KEY LAST NIBBLE(PORTD)
LINE5_LAST_DATA_H EQU 7EH
;THE FIFTH LINE KEY LAST NIBBLE(PORTH)
;------------------------------------------
;----------RAM BANK 2(100H--167H)----------
;------------------------------------------
TEMP_DEF_NUM EQU 00H
PAUSE_DEF_SECL EQU 01H
PAUSE_DEF_SECH EQU 02H
PAUSE_DEF_MINL EQU 03H
PAUSE_DEF_MINH EQU 04H
Time_second_timerL equ 05H
Time_second_timerH equ 06H
Time_minute_timerL equ 07H
Time_minute_timerH equ 08H
Time_disp_timer equ 09H
LOCK_COUNT equ 0aH
LOCK_BACK_COUNT equ 0bh
AUTO_START_COUNT equ 0ch
TIMER_PAUSE equ 0dh
BANK0 equ 0
BANK1 equ 1
BANK2 equ 2
;***************************************
; MACRO PART
;***************************************
INC8 MACRO B0XH ,B0XL
ADIM B0XL ,01H
LDI TEMP_M ,00H
ADCM B0XH ,00H
ENDM
;====================================
DEC8 MACRO B0XH ,B0XL
SBIM B0XL ,01H
LDI TEMP_M ,00H
SBCM B0XH ,00H
ENDM
;======================================
ADD8 MACRO B0XH,B0XL,IYH,IYL ;( XH,XL IS BANK0 )
ADIM B0XL ,IYL
LDI TEMP_M ,IYH
ADCM B0XH ,00H
ENDM
;=========================================
SUB8 MACRO B0XH,B0XL,IYH,IYL ;( XH,XL IS BANK0 )
SBIM B0XL ,IYL
LDI TEMP_M ,IYH
SBCM B0XH ,00H
ENDM
;=====================================
CJB4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BAZ $+2
BC ADDR
ENDM
;=====================================
CJB8 MACRO B0XH,B0XL,IYH,IYL,ADDR
SBI B0XH ,IYH
BAZ $+3
BC ADDR
JMP $+4
SBI B0XL ,IYL
BAZ $+2
BC ADDR
ENDM
;=====================================
CJBE4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BC ADDR
ENDM
;====================================
CJBE8 MACRO B0XH,B0XL,IYH,IYL,ADDR
SBI B0XH ,IYH
BAZ $+3
BC ADDR
JMP $+3
SBI B0XL ,IYL
BC ADDR
ENDM
;====================================
CJS4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BNC ADDR
ENDM
;====================================
CJS8 MACRO B0XH,B0XL,IYH,IYL,ADDR
SBI B0XH ,IYH
BAZ $+3
BNC ADDR
JMP $+3
SBI B0XL ,IYL
BNC ADDR
ENDM
;====================================
;CJSE4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BAZ ADDR
BNC ADDR
ENDM
;====================================
CJSE8 MACRO B0XH,B0XL,IYH,IYL,ADDR
SBI B0XH ,IYH
BAZ $+3
BNC ADDR
JMP $+4
SBI B0XL ,IYL
BAZ ADDR
BNC ADDR
ENDM
;====================================
CJE4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BAZ ADDR
ENDM
;====================================
CJNE4 MACRO B0X ,IY ,ADDR
SBI B0X ,IY
BNZ ADDR
ENDM
;====================================
CJE8 MACRO B0XH,B0XL,IYH,IYL,ADDR ;( XH,XL IS BANK0 )
SBI B0XH ,IYH
BNZ $+3
SBI B0XL ,IYL
BAZ ADDR
ENDM
;===================================
CJNE8 MACRO B0XH,B0XL,IYH,IYL,ADDR ;( XH,XL IS BANK0 )
SBI B0XH ,IYH
BNZ ADDR
SBI B0XL ,IYL
BNZ ADDR
ENDM
;====================================
DJZ4 MACRO B0X ,ADDR ;REALLY DECRESE 1
SBIM B0X ,01H
BAZ ADDR
ENDM
;====================================
DJNZ4 MACRO B0X ,ADDR ;REALLY DECRESE 1
SBIM B0X ,01H
BNZ ADDR
ENDM
;***************************************
; VECTOR ADDRESS
;***************************************
ORG 00H
JMP RESET
JMP TIMER0INT ;TIMER 0 INTERRUPT
RTNI
RTNI
RTNI
;***********************************************************************************
;SUBROUTINE NAME:TIMER0 INTERRUPT SERVICE SUBROUTINE
;FUNCTION:TIMER0 INTERRUPT SERVICE SUBROUTINE
;INPUT PARAMETER:RELAY_FLAG,WORK_FLAG0,WORK_FLAG1,WORK_FLAG2,WORK_FLAG3,NOW_COOK_TYPE
;OUTPUT PARAMETER:WORK_FLAG0,WORK_FLAG1,WORK_FLAG2,WORK_FLAG4
;USED REGISTERS:ACC,CLRACC,TEMP,RB1_TIMER_BUZ_CT0~RB1_TIMER_BUZ_CT2
; :TIMER_RAY_CT0~TIMER_RAY_CT2,TIMER_CS_CT,TIMER_WT_CT0~TIMER_WT_CT3
; :RB1_TIMER_SHARE_CT0~RB1_TIMER_SHARE_CT3,RB1_TIMER_SHARE_CT0~RB1_TIMER_SHARE_CT3
; :TIMER_KEY_CT0~TIMER_KEY_CT1,RB1_TIMER_HF_CT0~TIMER_HF_CT3
; :TIMER_CLOCK_CT0~TIMER_CLOCK_CT4,TIMER_PZ_CT0~TIMER_PZ_CT1,RB7_ALARM_SET,RB7_ALARM_ENV
; :TIMER_DY_CT0~TIMER_DY_CT1,CS_BUFFER,DOOR_T,DIS_LINE1H,DIS_LINE1L
; :DIS_LINE2H,DIS_LINE2L,DIS_LINE3H,DIS_LINE3L,DIS_LINE4H,DIS_LINE4L
; :DIS_LINE5H,DIS_LINE5L,DIS_LINE6H,DIS_LINE6L,RB1_WAIT_TIME_CT0~2
;**********************************************************************************
TIMER0INT:
STA ACC ,00H
ANDIM IRQ ,0111B ;CLEAR TIMER0 IRQ
BUZZER_OUTPUT_PART:
LDA RELAY_FLAG ,00H ;BUZZER CHECK
BA0 BUZZER_OUTPUT_PART10
ANDIM PORTF ,1110B ;SET PF.0 AS LOW STATE
JMP BUZZER_OUTPUT_PART20
BUZZER_OUTPUT_PART10:
ORIM PFOUT ,0001B ;SET PF.0 AS OUTPUT I/O
EORIM PORTF ,0001B ;OPEN BUZZER
BUZZER_OUTPUT_PART20:
LDI TEMP ,01H
ADDM RB1_TIMER_BUZ_CT0 ,01H ;BUZZER TIME TIMER PART
LDI CLRACC ,00H ;页间处理
ADCM RB1_TIMER_BUZ_CT1 ,01H
LDI CLRACC ,00H
ADCM RB1_TIMER_BUZ_CT2 ,01H
LDI CLRACC ,00H
ADCM RB1_TIMER_BUZ_CT3 ,01H
BUZZER_OUTPUT_PART99:
;=========================================
RELAY_OUTPUT_PART: ;OPEN & CLOSE RELAY PART
CLOSE_WAVE_OUTPUT_PART:
LDA WORK_FLAG3 ,00H
BA1 CLOSE_WAVE_OUTPUT_PART_LIGHTON ;WORK START
LDA WORK_FLAG3 ,00H ;LIGHT RELAY STATE CHECK
BA3 CLOSE_WAVE_OUTPUT_PART_LIGHTON
JMP CLOSE_WAVE_OUTPUT_PART10
CLOSE_WAVE_OUTPUT_PART_LIGHTON:
ORIM PFOUT ,1000B ;SET PF.3 AS OUTPUT I/O
ORIM PORTF ,1000B ;CLOSE LIGHT RELAY
CLOSE_WAVE_OUTPUT_PART10:
LDA RELAY_FLAG ,00H ;CHECK MICRO-WAVE STATE
BA1 CLOSE_WAVE_OUTPUT_PART99
ORIM PFOUT ,0100B ;SET PF.2 AS OUTPUT I/O
ANDIM PORTF ,1011B ;CLOSE MICRO-WAVE RELAY
JMP CLOSE_WAVE_OUTPUT_PART99
CLOSE_WAVE_OUTPUT_PART99:
OPEN_WAVE_OUTPUT_PART:
LDA RELAY_FLAG ,00H ;CHECK MICRO-WAVE STATE
BA1 OPEN_WAVE_OUTPUT_PART10
JMP OPEN_WAVE_OUTPUT_PART99
OPEN_WAVE_OUTPUT_PART10:
ORIM PFOUT ,0100B ;SET PF.2 AS OUTPUT I/O
ORIM PORTF ,0100B ;OPEN MICRO-WAVE RELAY
JMP OPEN_WAVE_OUTPUT_PART99
OPEN_WAVE_OUTPUT_PART99:
CLOSE_GRILL_OUTPUT_PART:
LDA WORK_FLAG3 ,00H
BA3 CLOSE_GRILL_OUTPUT_PART_LIGHTON
ORIM PFOUT ,1000B ;SET PF.3 AS OUTPUT I/O
ANDIM PORTF ,0111B ;CLOSE LIGHT RELAY
JMP CLOSE_GRILL_OUTPUT_PART10
CLOSE_GRILL_OUTPUT_PART_LIGHTON:
ORIM PFOUT ,1000B ;SET PF.3 AS OUTPUT I/O
ORIM PORTF ,1000B ;CLOSE LIGHT RELAY
;CLOSE_GRILL_OUTPUT_PART: ;GRILL RELAY OPEN/CLOSE PART
; LDA RELAY_FLAG ,00H ;LIGHT RELAY STATE CHECK
; BA3 CLOSE_GRILL_OUTPUT_PART10
; ORIM PFOUT ,1000B ;SET PF.3 AS OUTPUT I/O
; ANDIM PORTF ,0111B ;CLOSE LIGHT RELAY
CLOSE_GRILL_OUTPUT_PART10:
LDA RELAY_FLAG ,00H ;CHECK GRILL REALY STATE
BA2 CLOSE_GRILL_OUTPUT_PART99
ORIM PFOUT ,0010B ;SET PF.1 AS OUTPUT I/O
ANDIM PORTF ,1101B ;CLOSE GRILL RELAY
JMP CLOSE_GRILL_OUTPUT_PART99
CLOSE_GRILL_OUTPUT_PART99:
OPEN_GRILL_OUTPUT_PART:
LDA RELAY_FLAG ,00H ;CHECK GRILL REALY STATE
BA2 OPEN_GRILL_OUTPUT_PART10
JMP OPEN_GRILL_OUTPUT_PART99
OPEN_GRILL_OUTPUT_PART10:
ORIM PFOUT ,0010B ;SET PF.1 AS OUTPUT I/O
ORIM PORTF ,0010B ;OPEN GRILL RELAY
JMP OPEN_GRILL_OUTPUT_PART99
OPEN_GRILL_OUTPUT_PART99:
RELAY_OUTPUT_PART99:
;========================================
LOOK_TIME_POWER_TIMER_PART: ;LOOK TIME(POWER)/CHILD LOCK TIMER PART
LDI TEMP ,01H
ADDM RB1_TIMER_SHARE_CT0 ,01H ;RAM BANK 1 REGISTER
LDI CLRACC ,00H
ADCM RB1_TIMER_SHARE_CT2 ,01H ;RAM BANK 1 REGISTER
LDI CLRACC ,00H
ADCM RB1_TIMER_SHARE_CT3 ,01H ;RAM BANK 1 REGISTER
;================================================
RELAY_CHANGE_DELAY_TIMER_PART: ;WAVE,GRILL RELAY CHANGE DELAY 100MS TIMER PART
LDA PORTF ,00H ;GRILL RELAY
BA1 RELAY_CHANGE_DELAY_TIMER_PART10
;WAVE RELAY
BA2 RELAY_CHANGE_DELAY_TIMER_PART10
LDI TEMP ,01H
ADDM RB1_RELAY_CHANGE_CT0 ,01H ;BANK 1 REGISTER
LDI CLRACC ,00H
ADCM RB1_RELAY_CHANGE_CT1 ,01H ;BANK 1 REGISTER
LDI CLRACC ,00H
ADCM RB1_RELAY_CHANGE_CT2 ,01H ;BANK 1 REGISTER
JMP RELAY_CHANGE_DELAY_TIMER_PART99
RELAY_CHANGE_DELAY_TIMER_PART10:
LDI CLRACC ,00H
STA RB1_RELAY_CHANGE_CT0 ,01H ;BANK 1 REGISTER
STA RB1_RELAY_CHANGE_CT1 ,01H ;BANK 1 REGISTER
STA RB1_RELAY_CHANGE_CT2 ,01H ;BANK 1 REGISTER
RELAY_CHANGE_DELAY_TIMER_PART99:
;========================================
RAY_DISPLAY_TIMER_PART: ;DISPLAY RAY TIMER PART
ADIM TIMER_RAY_CT0 ,01H
LDI CLRACC ,00H
ADCM TIMER_RAY_CT1 ,00H
LDI CLRACC ,00H
ADCM TIMER_RAY_CT2 ,00H
CJS8 TIMER_RAY_CT2,TIMER_RAY_CT1,07H,0DH,RAY_DISPLAY_TIMER_PART99 ;500MS
LDI TIMER_RAY_CT0 ,00H ;CLEAR DISPLAY RAY TIMER
LDI TIMER_RAY_CT1 ,00H
LDI TIMER_RAY_CT2 ,00H
EORIM WORK_FLAG0 ,1000B ;SET 500MS DISPLAY RAY FLAG
BA3 RAY_DISPLAY_TIMER_PART99
EORIM WORK_FLAG0 ,0010B ;SET 1S DISPLAY RAY FLAG
RAY_DISPLAY_TIMER_PART99:
;============================================
CLOCK_TIMER_PART: ;CLOCK TIMER PART
LDA WORK_FLAG1 ,00H
BA3 CLOCK_TIMER_PART10 ;CLOCK ALREADY SET
JMP CLOCK_TIMER_PART99
CLOCK_TIMER_PART10:
ADIM TIMER_CLOCK_CT0 ,01H
LDI CLRACC ,00H
ADCM TIMER_CLOCK_CT1 ,00H
LDI CLRACC ,00H
ADCM TIMER_CLOCK_CT2 ,00H
LDI CLRACC ,00H
ADCM TIMER_CLOCK_CT3 ,00H
LDI CLRACC ,00H
ADCM TIMER_CLOCK_CT4 ,00H
CLOCK_TIMER_PART99:
;============================================
TIMER_500MS_PART: ;500MS TIMER PART
LDI TEMP ,01H
ADDM RB1_DOOR_OPEN_CT3 ,01H
LDI CLRACC ,00H
ADCM RB1_DOOR_OPEN_CT4 ,01H
LDI CLRACC ,00H
ADCM RB1_DOOR_OPEN_CT5 ,01H
STA TEMP ,00H
LDA RB1_DOOR_OPEN_CT4 ,01H
STA CLRACC ,00H
CJS8 TEMP,CLRACC,07H,0DH,TIMER_500MS_PART99 ;500MS
LDI CLRACC ,00H
STA RB1_DOOR_OPEN_CT3 ,01H ;CLEAR TIMER
STA RB1_DOOR_OPEN_CT4 ,01H
STA RB1_DOOR_OPEN_CT5 ,01H
ORIM WORK_FLAG0 ,0100B ;SET 500 MS FLAG
TIMER_500MS_PART99:
;============================================
TIMER_1000MS_PART:
LDA LOCK_COUNT ,BANK2
BNZ TIMER_1000MS_PART10
LDA WORK_FLAG4 ,00H
BA1 TIMER_1000MS_PART10
SBI WORK_TYPE ,07H
BNZ $+4
LDA WORK_FLAG8 ,BANK0
BA1 $+2
JMP TIMER_1000MS_PART10
LDA WORK_FLAG3 ,00H ;WORK START CHECK
BA1 TIMER_1000MS_PART10 ;START STATE
BA2 TIMER_1000MS_PART99
LDI TIMER_WT_CT0 ,00H
LDI TIMER_WT_CT1 ,00H
LDI TIMER_WT_CT2 ,00H
LDI TIMER_WT_CT3 ,00H
ANDIM WORK_FLAG1 ,1101B ;CLEAR 1S FLAG
JMP TIMER_1000MS_PART99
TIMER_1000MS_PART10: ;WORK ALREADY START
ADIM TIMER_WT_CT0 ,01H
LDI CLRACC ,00H
ADCM TIMER_WT_CT1 ,00H
LDI CLRACC ,00H
ADCM TIMER_WT_CT2 ,00H
LDI CLRACC ,00H
ADCM TIMER_WT_CT3 ,00H
CJS8 TIMER_WT_CT2,TIMER_WT_CT1,0FH,0AH,TIMER_1000MS_PART99
LDI TIMER_WT_CT0 ,00H
LDI TIMER_WT_CT1 ,00H
LDI TIMER_WT_CT2 ,00H
LDI TIMER_WT_CT3 ,00H
ORIM WORK_FLAG1 ,0010B ;SET 1S FLAG
ORIM WORK_FLAG7 ,0010B
TIMER_1000MS_PART99:
;=======================================
KEY_SCAN_TIMER_PART: ;5MS KEY SCAN TIMER PART
ADIM TIMER_KEY_CT0 ,01H
LDI CLRACC ,00H
ADCM TIMER_KEY_CT1 ,00H
CJS8 TIMER_KEY_CT1,TIMER_KEY_CT0,03H,01H,KEY_SCAN_TIMER_PART99 ;12.25MS CHECK
ORIM WORK_FLAG2 ,1000B ;SET 12.25 MS SCAN KEY FLAG
LDI TIMER_KEY_CT0 ,00H
LDI TIMER_KEY_CT1 ,00H
ADIM LONG_PRESS_EACH_CT ,01H ;LONG PRESS EACH TIME TIMER USED REGISTER
CJS4 LONG_PRESS_EACH_CT,04H,KEY_SCAN_TIMER_PART99
LDI LONG_PRESS_EACH_CT ,00H
ORIM WORK_FLAG1 ,0100B ;SET 50MS(49MS) LONG PRESS KEY ENABLE FLAG
KEY_SCAN_TIMER_PART99:
;=======================================
DISPLAY_OUTPUT_PART: ;DISPLAY OUTPUT PART
ADIM TIMER_DIS_CT ,01H ;1MS CHECK
CJS4 TIMER_DIS_CT,07H,DISPLAY_OUTPUT_PART05
LDI TIMER_DIS_CT ,00H
ADIM DISPLAY_BIT ,01H
CJS4 DISPLAY_BIT,07H,DISPLAY_OUTPUT_PART05
LDI DISPLAY_BIT ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART05: ;DISPLAY LINE SELECT
LDA WORK_FLAG8 ,00H ;SCAN KEY CHECK
BA2 DISPLAY_OUTPUT_PART99
LDI PBOUT ,0FH ;CLOSE DISPLAY
LDI PDOUT ,0FH
LDI PHOUT ,0FH
LDI PORTB ,00H
ANDIM PORTD ,0011B
LDI PORTH ,00H
CJE4 DISPLAY_BIT,01H,DISPLAY_OUTPUT_PART10
CJE4 DISPLAY_BIT,02H,DISPLAY_OUTPUT_PART20
CJE4 DISPLAY_BIT,03H,DISPLAY_OUTPUT_PART30
CJE4 DISPLAY_BIT,04H,DISPLAY_OUTPUT_PART40
CJE4 DISPLAY_BIT,05H,DISPLAY_OUTPUT_PART50
CJE4 DISPLAY_BIT,06H,DISPLAY_OUTPUT_PART60
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART10: ;THE FIRST LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,0111B ;SET PA.3 AS LOW STATE
ORIM PDOUT ,0011B
ORIM PORTD ,0011B
LDA DIS_LINE6H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
STA TEMP ,00H
ANDIM TEMP ,1100B
ORM PORTD ,00H
LDA DIS_LINE6L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART20: ;THE SECOND LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,1011B ;SET PA.2 AS LOW STATE
ORIM PDOUT ,0011B
ORIM PORTD ,0011B
LDA DIS_LINE5H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
STA TEMP ,00H
ANDIM TEMP ,1100B
ORM PORTD ,00H
LDA DIS_LINE5L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART30: ;THE THIRD LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,1101B ;SET PA.1 AS LOW STATE
ORIM PDOUT ,0011B
ORIM PORTD ,0011B
LDA DIS_LINE4H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
STA TEMP ,00H
ANDIM TEMP ,1100B
ORM PORTD ,00H
LDA DIS_LINE4L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART40: ;THE FOUTRH LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,1110B ;SET PA.0 AS LOW STATE
ORIM PDOUT ,0011B
ORIM PORTD ,0011B
LDA DIS_LINE3H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
STA TEMP ,00H
ANDIM TEMP ,1100B
ORM PORTD ,00H
LDA DIS_LINE3L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART50: ;THE FIFTH LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,0FH
ORIM PDOUT ,0011B
ANDIM PORTD ,1110B
ORIM PORTD ,0010B
LDA DIS_LINE2H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
STA TEMP ,00H
ORM PORTD ,00H
LDA DIS_LINE2L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART60: ;THE SIXTH LINE OUTPUT
LDI PAOUT ,0FH
LDI PORTA ,0FH
ORIM PDOUT ,0011B
ANDIM PORTD ,1101B
ORIM PORTD ,0001B
LDA DIS_LINE1H ,01H ;BANK 1 REGISTER
STA PORTH ,00H
ORM PORTD ,00H
LDA DIS_LINE1L ,01H ;BANK 1 REGISTER
STA PORTB ,00H
JMP DISPLAY_OUTPUT_PART99
DISPLAY_OUTPUT_PART99:
JMP TIMER0INT99
;=======================================
TIMER0INT99:
LDI IE ,1000B ;OPEN TIMER0 INT
LDA ACC ,00H
RTNI
;**********************************************************
;SUBROUTINE NAME:INT DATA MEMORY
;FUNCTION:INT DATA MEMORY REGISTERS(030H--16FH)
;INPUT PARAMETER:NO PARAMETER
;OUTPUT PARAMETER:NO PARAMETER
;USED REGISTERS:CLRACC
;**********************************************************
INTDMR: ;INT DATA MEMORY REGISTERS(030H--16FH)
LDI DPH ,00H
LDI DPM ,03H
LDI DPL ,00H
INT0:
LDI INX ,00H
ADIM DPL ,01H
LDI CLRACC ,00H
ADCM DPM ,00H
LDA DPM ,00H
BNZ INT1
LDA DPL ,00H
BNZ INT1
ADIM DPH ,01H
INT1:
SBI DPH ,02H
BNZ INT0
SBI DPM ,06H
BNZ INT0
SBI DPL ,0FH
BNZ INT0
RTNI
;**********************************************************
; INT DISPLAY DATA
;**********************************************************
INT_DIS_DATA:
LDI TEMP_R0 ,0FH
STA DIS_LINE1H ,01H ;RAM BANK 1 REGISTER
STA DIS_LINE1L ,01H
STA DIS_LINE2H ,01H
STA DIS_LINE2L ,01H
STA DIS_LINE3H ,01H
STA DIS_LINE3L ,01H
STA DIS_LINE4H ,01H
STA DIS_LINE4L ,01H
STA DIS_LINE5H ,01H
STA DIS_LINE5L ,01H
STA DIS_LINE6H ,01H
STA DIS_LINE6L ,01H
RTNI
;**********************************************************
; DELAY PART
;**********************************************************
DELAY:
LDI TEMP_R2 ,0FH
LDI TEMP_R1 ,0FH
LDI TEMP_R0 ,0FH
DELAY1:
LDI WDT ,0101B ;CLEAR WATCH DOG(16MS)
NOP
NOP
NOP
NOP
NOP
SBIM TEMP_R0 ,01H
LDI TEMP_R3 ,00H
SBCM TEMP_R1 ,00H
LDI TEMP_R3 ,00H
SBCM TEMP_R2 ,00H
BC DELAY1
RTNI
KEY_DELAY:
LDI TEMP_R0 ,0AH ;DELAY
SBIM TEMP_R0 ,01H
BC $-1
RTNI
;***********************************************************
; MAIN PROGRAMME PART
;***********************************************************
RESET:
NOP
LDI IE ,00H
LDI T0M ,0111B ;4MHZ,0.25MS,SET TO SHARED WITH PORTC.3
LDI T0L ,06H
LDI T0H ,00H
LDI CMP_CONTROL ,00H ;COMPARATOR OUTPUT FALLING EDGE GENERATE INTERRUPT,PORTE.0 IS SHARED AS I/O,INTERNAL REFERENCE VOLTAGE(VDD/2) IS SELECTED AS COMPARATOR NEGATIVE INPUT,COMPARATOR DISABLE
LDI CMP_STATUS ,00H ;COMPARATOR0 IS NOT OPERATION,COMPARATOR POSITIVE INPUT IS FROM CMPP1
LDI T2SET ,00H ;TIMER2 TIMER/COUNTER STOPS
LDI T2_SIGNAL_SET ,00H ;NO EXTERNAL SIGNAL SOURCE IS SELECTED
LDI TONE1_VOLUME_H ,00H ;TONE GENERATOR 1 DISABLE
LDI TONE1_VOLUME_L ,00H
LDI TONE2_VOLUME_H ,00H ;TONE GENERATOR 2 DISABLE
LDI TONE2_VOLUME_L ,00H
LDI PORTA ,0FH ;CLOSE DISPLAY
LDI PORTB ,00H
LDI PORTC ,00H
LDI PORTD ,0011B
LDI PORTE ,00H
LDI PORTF ,00H ;CLOSE RELAY,BUZZER
LDI PAOUT ,0FH ;SET PORTA AS OUTPUT I/O
LDI PBOUT ,0FH ;SET PORTB AS OUTPUT I/O
LDI PCOUT ,00H ;SET PORTC AS INPUT I/O
LDI PDOUT ,0FH ;SET PORTD AS OUTPUT I/O
LDI PEOUT ,00H ;SET PORTE AS INPUT I/O
LDI PFOUT ,1111B ;SET PORTF AS OUTPUT I/O
CALL DELAY
CALL DELAY
CALL INTDMR ;CLEAR DATA MEMORY REGISTERS
LDI BUZZER_TYPE ,01H ;SET POWER ON BUZZER FLAG
ORIM WORK_FLAG2 ,0100B ;SET CODDING SWITCH DISABLE FLAG
CALL INT_DIS_DATA
ORIM WORK_FLAG8 ,1000B ;SET POWER ON LCD ON FLAG
LDI TIME_HORH ,01H
LDI TIME_HORL ,02H
LDI TIME_MINH ,00H
LDI TIME_MINL ,00H
ORIM WORK_FLAG1 ,1000B ;SET CLOCK ALREADY SET FLAG
;*******************2006/4/5 15:08**********************
LDI T0M ,0111B ;4MHZ,0.25MS,SET TO SHARED WITH PORTC.3
LDI T0L ,06H
LDI T0H ,00H
;*******************2006/4/5 15:08**********************
LDI WDT ,0101B ;CLEAR WATCH DOG(16MS)
LDI IRQ ,00H ;CLEAR INTERRUPT REQUEST
;*******************2006/4/7 09:00**********************
LDI KEY_LS ,0FH
;*******************2006/4/7 09:00**********************
MAINPART:
LDI WDT ,0101B ;CLEAR WATCH DOG(16MS)
LDI IE ,1000B ;OPEN TIMER0 INT
LDI T0M ,0111B ;4MHZ,0.25MS
;**************************************************************************
;SUBROUTINE NAME:KEY SCAN AND PROCESS PART
;FUNCTION:SCAN ALL KEY AND PROCESS
;INPUT PARAMETER:WORK_FLAG2,WORK_FLAG3,WORK_FLAG4,RB1_TIMER_SHARE_CT0~RB1_TIMER_SHARE_CT3
;WORK_FLAG7
;OUTPUT PARAMETER:WORK_TYPE,BUZZER_TYPE
;USED REGISTERS:TEMP_R0~TEMP_R5,DOOR_T,KEY_LS,KEY_T,KEY_VALUE,KEY_VALUEL,KEY_VALUEH
; :CODING_VALUEL,CODING_VALUEH,NOW_COOK_TYPE,MUL_COOK_TYPE1~MUL_COOK_TYPE3
; :MUL_WORK_MINH1~3,MUL_WORK_MINL1~3,MUL_WORK_SECH1~3,MUL_WORK_SECL1~3
; :MUL_ORDER1~3
;***************************************************************************
KEY_SCAN:
LDA WORK_FLAG2 ,00H ;12.25 MS?NO,GOTO OUT KEYSCAN
BA3 READKEY
JMP OUT_KEY_PART
READKEY:
ANDIM WORK_FLAG2 ,0111B ;CLEAR 12.25 MS FLAG
ORIM WORK_FLAG8 ,0100B ;SET KEY SCAN FLAG
LDI PAOUT ,0FH ;CLOSE DISPLAY
LDI PORTA ,0FH
LDI PBOUT ,0FH
LDI PORTB ,00H
LDI PDOUT ,0FH
LDI PORTD ,0011B
LDI PHOUT ,0FH
LDI PORTH ,00H
NOP
LDI PBOUT ,00H ;SET PB AS INPUT I/O
LDI PDOUT ,0011B ;SET PD.3 PD.2 AS INPUT I/O
LDI PHOUT ,00H ;SET PH AS INPUT I/O
LDI PB_PULL_HIGH ,0FH ;SET PB PULL HIGH
LDI PD_PULL_HIGH ,1100B ;SET PD.3 PD.2 PULL HIGH
LDI PH_PULL_HIGH ,0FH ;SET PH PULL HIGH
READ_LINE1:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,0FH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ORIM PORTC ,0100B
LDI PEOUT ,00H
LDI PE_PULL_HIGH ,0FH ;SET PE PULL HIGH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ANDIM PORTC ,1011B ;SET PC.2 AS LOW STATE
CALL KEY_DELAY
LDA PORTB ,00H ;READ THE FIRST LINE
STA LINE1_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
LDA PORTD ,00H
STA LINE1_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
READ_LINE2:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,0FH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ORIM PORTC ,0100B
LDI PEOUT ,0100B ;SET PE.2 AS OUTPUT I/O
ANDIM PCOUT ,1011B ;SET PC.2 AS INPUT I/O
LDI PC_PULL_HIGH ,0100B ;PC.2 PULL HIGH
LDI PE_PULL_HIGH ,1011B ;SET PE.3 PE.1 PE.0 PULL HIGH
ANDIM PORTE ,1011B ;SET PE.2 AS LOW STATE
CALL KEY_DELAY
LDA PORTB ,00H ;READ THE SECOND LINE
STA LINE2_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
LDA PORTD ,00H
STA LINE2_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
READ_LINE3:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,0FH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ORIM PORTC ,0100B
LDI PEOUT ,0010B ;SET PE.1 AS OUTPUT I/O
ANDIM PORTE ,1101B ;SET PE.1 AS LOW STATE
ANDIM PCOUT ,1011B ;SET PC.2 AS INPUT I/O
LDI PC_PULL_HIGH ,0100B ;PC.2 PULL HIGH
LDI PE_PULL_HIGH ,1101B ;SET PE.3 PE.2 PE.0 PULL HIGH
CALL KEY_DELAY
LDA PORTB ,00H ;READ THE THIRD LINE
STA LINE3_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
LDA PORTD ,00H
STA LINE3_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
READ_LINE4:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,0FH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ORIM PORTC ,0100B
LDI PEOUT ,0001B ;SET PE.0 AS OUTPUT I/O
ANDIM PORTE ,1110B ;SET PE.0 AS LOW STATE
ANDIM PCOUT ,1011B ;SET PC.2 AS INPUT I/O
LDI PC_PULL_HIGH ,0100B ;PC.2 PULL HIGH
LDI PE_PULL_HIGH ,1110B ;SET PE.3 PE.2 PE.1 PULL HIGH
CALL KEY_DELAY
LDA PORTB ,00H ;READ THE FOURTH LINE
STA LINE4_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
LDA PORTD ,00H
STA LINE4_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
READ_LINE5:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,0FH
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ORIM PORTC ,0100B
LDI PEOUT ,1000B ;SET PE.3 AS OUTPUT I/O
ANDIM PORTE ,0111B ;SET PE.3 AS LOW STATE
ANDIM PCOUT ,1011B ;SET PC.2 AS INPUT I/O
LDI PC_PULL_HIGH ,0100B ;PC.2 PULL HIGH
LDI PE_PULL_HIGH ,0111B ;SET PE.0 PE.2 PE.1 PULL HIGH
CALL KEY_DELAY
LDA PORTB ,00H ;READ THE FIFTH LINE
STA LINE5_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
LDA PORTD ,00H
STA LINE5_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
;==========================================================
DOOR_CHECK:
LDI PAOUT ,0FH ;CLOSE DISPLAY
LDI PORTA ,0FH
LDI PBOUT ,0FH
LDI PORTB ,00H
LDI PDOUT ,0FH
LDI PORTD ,0011B
LDI PHOUT ,0FH
LDI PORTH ,00H
ANDIM PAOUT ,1101B ;SET PA.1 AS INPUT I/O
LDI PA_PULL_HIGH ,1101B ;CLOSE PORTA.1 PULL HIGH
NOP
CALL KEY_DELAY
NOP
LDA PORTA ,00H ;SCAN DOOR STATE
BA1 DOOR_CHECK4
JMP DOOR_CHECK3
DOOR_CHECK3: ;DOOR CLOSE STATE
LDI DOOR_T ,00H ;CLEAR DOOR CHECK TIMES
ANDIM WORK_FLAG3 ,0111B ;CLEAR DOOR OPEN FLAG
JMP DOOR_CHECK99
DOOR_CHECK4:
ADIM DOOR_T ,01H ;DOOR OPEN STATE
CJS4 DOOR_T,08H,DOOR_CHECK99 ;CHECK DOOR STATE 8 TIMES
ORIM WORK_FLAG3 ,1000B ;SET DOOR OPEN FLAG
DOOR_CHECK99:
LDI PEOUT ,0FH ;SET PE AS OUTPUT I/O
LDI PORTE ,00H ;SET PE AS LOW STATE
ORIM PCOUT ,0100B ;SET PC.2 AS OUTPUT I/O
ANDIM PORTC ,1011B ;SET PC.2 AS LOW STATE
ORIM PDOUT ,0011B ;SET PD.1,PD.0 AS OUTPUT I/O
ORIM PORTD ,0011B ;SET PD.1,PD.0 AS HIGH STATE
ANDIM WORK_FLAG8 ,1011B ;CLEAR KEY SCAN FLAG
;===============================================
LDA MACHINE_TYPE ,00H ;TEST MODE CHECK
BA0 KEY_CHECK99
;=================================================
KEY_CHECK:
LDA LINE1_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
STA TEMP_R0 ,00H
ANDIM TEMP_R0 ,1100B ;CLEAR BIT1 BIT0
STA LINE1_CURRENT_DATA_D ,01H
LDA LINE2_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
STA TEMP_R0 ,00H
ANDIM TEMP_R0 ,1100B ;CLEAR BIT1 BIT0
STA LINE2_CURRENT_DATA_D ,01H
LDA LINE3_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
STA TEMP_R0 ,00H
ANDIM TEMP_R0 ,1100B ;CLEAR BIT1 BIT0
STA LINE3_CURRENT_DATA_D ,01H
LDA LINE4_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
STA TEMP_R0 ,00H
ANDIM TEMP_R0 ,1100B ;CLEAR BIT1 BIT0
STA LINE4_CURRENT_DATA_D ,01H
LDA LINE5_CURRENT_DATA_D ,01H ;BANK 1 REGISTER
STA TEMP_R0 ,00H
ANDIM TEMP_R0 ,1100B ;CLEAR BIT1 BIT0
STA LINE5_CURRENT_DATA_D ,01H
LDI TEMP_R0 ,0FH ;NO KEY PRESS CHECK
SUB LINE1_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
BNZ KEY_CHECK01
LDI TEMP_R0 ,0FH
SUB LINE2_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
BNZ KEY_CHECK01
LDI TEMP_R0 ,0FH
SUB LINE3_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
BNZ KEY_CHECK01
LDI TEMP_R0 ,0FH
SUB LINE4_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
BNZ KEY_CHECK01
LDI TEMP_R0 ,0FH
SUB LINE5_CURRENT_DATA_B ,01H ;BANK 1 REGISTER
BNZ KEY_CHECK01
LDI TEMP_R0 ,0CH
SUB LINE1_CURRENT_DATA_D ,01H
BNZ KEY_CHECK01
LDI TEMP_R0 ,0CH
SUB LINE2_CURRENT_DATA_D ,01H
BNZ KEY_CHECK01
LDI TEMP_R0 ,0CH
SUB LINE3_CURRENT_DATA_D ,01H
BNZ KEY_CHECK01
LDI TEMP_R0 ,0CH
SUB LINE4_CURRENT_DATA_D ,01H
BNZ KEY_CHECK01
LDI TEMP_R0 ,0CH
SUB LINE5_CURRENT_DATA_D ,01H
BNZ KEY_CHECK01
CALL SAVE_KEY_SCAN_VALUE ;SAVE CURRENT KEY SCAN VALUE
LDI KEY_LS ,0EH ;NO KEY
LDA WORK_FLAG3 ,00H
BA0 KEY_CHECK00 ;CHECK LOOK TIME/PRE-TIME FLAG
LDA WORK_FLAG0 ,00H
BA0 KEY_CHECK00 ;CHECK LOOK POWER FLAG
CALL CLEAR_LOOK_TIME ;CLEAR LONG PRESS(CHILD LOCK) TIME
LDI LONG_PRESS_EACH_CT ,00H ;CLEAR LONG PRESS KEY USED COUNTER
STA LONG_PRESS_TIME_CT ,01H
STA LONG_PRESS_EACH_CT1 ,01H
ANDIM WORK_FLAG4 ,0111B ;CLEAR LONG PRESS KEY ON FLAG
-----此内容被lixu于2006-10-20,20:12:41编辑过
-----此内容被lixu于2006-10-20,20:15:27编辑过 |
|