⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ld094.asm

📁 这是本人写的一款开关自动转换程序
💻 ASM
📖 第 1 页 / 共 5 页
字号:
                call          OpenZd                   ;开中断

;*****************************************************8
;*****************************************************
AQtime 
                 call         LedInt 
                bsf           DEBUG_FALG,0             ;哪个LED闪烁标志
                 ;读取上次记忆值  ,EEPORM,保存在地址为2的寄存器中(设置传感器类型)
               movlw        D'4'             ;送地址
               call         RED_EE           ;读上次值
               movwf        NEW_RpmData     
               movwf        TEMP             ;把上次值存于TEMP,用于临时比较
                   ;比较,判断保存的是哪种,一共有7种,值分别为“2,4,6,8”
               movf        TEMP,f
               btfsc        STATUS,Z
               goto         AQtime1           ;默认时间为0
                 movlw        D'1'
               subwf        TEMP,W
               btfsc        STATUS,Z
               goto         AQtime2           ;默认时间为1S
                 movlw        D'2'
               subwf        TEMP,W
               btfsc        STATUS,Z
               goto         AQtime3           ;默认时间为2S
                  movlw        D'3'
               subwf        TEMP,W
               btfsc        STATUS,Z
               goto         AQtime4           ;默认时间为3S
                   movlw        D'4'
               subwf        TEMP,W
               btfsc        STATUS,Z
               goto         AQtime5           ;默认时间为4S
                  movlw        D'5'
               subwf        TEMP,W
               btfsc        STATUS,Z
               goto         AQtime6           ;默认时间为5S
               goto         AQtime7           ;默认时间为6S
            ;------------------------
AQtime1 
               call         LedInt                     ;灯全部不显示
               movlw         0
               movwf         NEW_RpmData               ;默认时间
AQtime1loop
               clrwdt       
               call          KEYSCAN         ;扫描按键
               btfss         AJBIAT,7
               GOTO          AQtime1loop

               call          DebugKey
               btfsc         DebugModeTime,short           
               goto          AQtime2                             
               btfsc         DebugModeTime,Long           
               goto          YEWEISZ                              ;去设置下个方案模式
  
           ;------------------------
AQtime2 
               call         LedInt                    
               movlw         d'1'
               movwf         NEW_RpmData               ;默认时间1s  1=32ms
               bsf          YWLED2 
AQtime2loop
               clrwdt       
               call          KEYSCAN       
               btfss         AJBIAT,7
               GOTO          AQtime2loop
               call          DebugKey
               btfsc         DebugModeTime,short          
               goto          AQtime3                            
               btfsc         DebugModeTime,Long           
               goto          YEWEISZ                            
           ;------------------------
AQtime3 
               call         LedInt                     ;灯全部不显示
               movlw         d'2'
               movwf         NEW_RpmData               ;默认时间2
               bsf          YWLED2 
               bsf          YWLED3 
AQtime3loop
               clrwdt       
               call          KEYSCAN       
               btfss         AJBIAT,7
               GOTO          AQtime3loop

               call          DebugKey
               btfsc         DebugModeTime,short          
               goto          AQtime4                           
               btfsc         DebugModeTime,Long           
               goto          YEWEISZ                            
           ;------------------------
AQtime4 
                  call         LedInt                     ;灯全部不显示
               movlw         d'3'
               movwf         NEW_RpmData               ;默认时间
               bsf          YWLED2 
               bsf          YWLED3
               bsf          YWLED4 
         
AQtime4loop
               clrwdt       
               call          KEYSCAN       
               btfss         AJBIAT,7
               GOTO          AQtime4loop

               call          DebugKey
               btfsc         DebugModeTime,short          
               goto          AQtime5                            
               btfsc         DebugModeTime,Long           
               goto          YEWEISZ                            
           ;------------------------
AQtime5 
                   call         LedInt                     ;灯全部不显示
               movlw         d'4'
               movwf         NEW_RpmData               ;默认时间4
                 bsf          YWLED2 
               bsf          YWLED3
               bsf          YWLED4 
                 bsf          YWLED5 
             
AQtime5loop
               clrwdt       
               call          KEYSCAN        
               btfss         AJBIAT,7
               GOTO          AQtime5loop
               call          DebugKey
               btfsc         DebugModeTime,short           
               goto          AQtime6                             
               btfsc         DebugModeTime,Long            
               goto          YEWEISZ                           
            ;------------------------
AQtime6 
                   call         LedInt                     ;灯全部不显示
               movlw         d'5'
               movwf         NEW_RpmData               ;默认时间5s
                   bsf          YWLED2 
               bsf          YWLED3
               bsf          YWLED4 
                 bsf          YWLED5 
                 bsf           GASLED                   ;GAS状态灯
AQtime6loop
               clrwdt       
               call          KEYSCAN        
               btfss         AJBIAT,7
               GOTO          AQtime6loop
               call          DebugKey
               btfsc         DebugModeTime,short        
               goto          AQtime7                             
               btfsc         DebugModeTime,Long           
               goto          YEWEISZ                             
           ;------------------------
AQtime7 
                   call         LedInt                     ;灯全部不显示
               movlw         d'6'
               movwf         NEW_RpmData               ;默认时间6s
                   bsf          YWLED2 
               bsf          YWLED3
               bsf          YWLED4 
                 bsf          YWLED5 
                 bsf           GASLED                  
                 bsf           YOULED 
AQtime7loop
               clrwdt       
               call          KEYSCAN        
               btfss         AJBIAT,7
               GOTO          AQtime7loop

               call          DebugKey
               btfsc         DebugModeTime,short          
               goto          AQtime1                             
               btfsc         DebugModeTime,Long          
               goto          YEWEISZ                             
;************************************************************************
;************************************************************************
YEWEISZ
               CLRF         DEBUG_FALG 
               bsf           DEBUG_FALG,1             ;哪个LED闪烁标志
               call         LedInt  

                 ;读取上次记忆值  ,EEPORM,保存在地址为2的寄存器中(设置传感器类型)
               movlw        D'2'             ;送地址
               call         RED_EE           ;读上次值     
               movwf        TEMP             ;把上次值存于TEMP,用于临时比较
               ;比较,判断保存的是哪种,一共有四种,值分别为“2,4,6,8”
               movlw        D'2'
               subwf        TEMP,W
               btfss        STATUS,Z
               goto         YEWEI_COMP1     ;NO
               goto         CGQ0
;------------------------------------------------
YEWEI_COMP1
               MOVLW        D'4'
               SUBWF        TEMP,W
               BTFSS        STATUS,Z
               GOTO         YEWEI_COMP2     ;NO
               GOTO         CGQ2
;---------------------------------------------------------
YEWEI_COMP2
               MOVLW        D'6'
               SUBWF        TEMP,W
               BTFSS        STATUS,Z
               GOTO         YEWEI_COMP3     ;NO
               GOTO         CGQ3
;---------------------------------------------------------
YEWEI_COMP3
                      ;0-90欧母的传感器,黄,绿灯全灭     
               GOTO         CGQ4
;-----------------------------------------------------------------------------------
         ;-------出厂默认传感器,绿灯亮,LAMDI公司的传感器------
CGQ0
               bsf           GASLED               ;GAS状态灯;LAMDI公司的传感器,
               movlw         2
               movwf         YEXH                ;把液位型号值写到EEPROM
               bcf           YOULED 
               call          AJPDOPEN            ;检查按键释放完成
CGQ1
               clrwdt       
               call          KEYSCAN         ;扫描按键
               btfss         AJBIAT,7
               GOTO          CGQ1 

               call          DebugKey
               btfsc         DebugModeTime,short         
               goto          CGQ2                            
               btfsc         DebugModeTime,Long          
               goto          DEBUG_2                            
;-----------------------------------------------------------------------------------
;--------------------------;AEB公司的传感器,黄灯亮--------------------------------
CGQ2
               
               bsf           YOULED                   ;油状态灯
               movlw         4
               movwf         YEXH                ;把液位型号值写到EEPROM
               bcf           GASLED                   ;GAS状态灯
                 call          AJPDOPEN            
CGQ2A
               clrwdt       
               call          KEYSCAN         ;扫描按键
               btfss         AJBIAT,7
               GOTO          CGQ2A 
               call          DebugKey
               btfsc         DebugModeTime,short          
               goto          CGQ3                               ;改变液位型号
               btfsc         DebugModeTime,Long           
               goto          DEBUG_2                       
;-----------------------------------------------------------------------------------
;--------------------------;--------------------------------
CGQ3 
                   ;
               bsf           YOULED                   ;油状态灯
               movlw         6
               movwf         YEXH                ;把液位型号值写到EEPROM
               bsf           GASLED                   ;GAS状态灯
                 call          AJPDOPEN            ;检查按键释放完成
CGQ3A
               clrwdt       
               call          KEYSCAN        
               btfss         AJBIAT,7
               GOTO          CGQ3A 
               call          DebugKey
               btfsc         DebugModeTime,short        
               goto          CGQ4                             
               btfsc         DebugModeTime,Long           
               goto          DEBUG_2 
             ;-------------------------------
CGQ4
               bcf           YOULED                   ;油状态灯
               movlw         8
               movwf         YEXH                ;把液位型号值写到EEPROM
               bcf           GASLED                   ;GAS状态灯    
                call          AJPDOPEN           
CGQ4A
               clrwdt       
               call          KEYSCAN        
               btfss         AJBIAT,7
               GOTO          CGQ4A 

               call          DebugKey
               btfsc         DebugModeTime,short           
               goto          CGQ0                              
               btfsc         DebugModeTime,Long          
               goto          DEBUG_2 
;-------------------------------------------------------------------------
;-----------------------设置浮动控制方式----------------------------------
DEBUG_2 
               clrf       DEBUG_FALG
               call       LedInt
               bsf        DEBUG_FALG,2       ;哪个LED闪烁标志
DEBUG_2a
               
               ;读取上次记忆值  ,EEPORM,保存在地址为2的寄存器中
               movlw       D'3'             ;送地址
               call        RED_EE           ;读上次值
                 movwf        TEMP             ;把上次值存于TEMP,用于临时比
               movf      TEMP,f
                     
               btfss       STATUS,Z
               goto        ZU_UP         ;NO 
               ;不使用模式
ZU_Down
               bcf           GASLED                   ;GAS状态灯(绿LED)
               movlw         0
               movwf         ZSKZ               ;把转速控制方式值写到EEPROM
               bsf           YOULED                   ;油状态灯 
                 call          AJPDOPEN            ;检查按键释放完成
ZU_Down1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -