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

📄 migalka.lst

📁 Lamp switcher. (4 channels with PWM)
💻 LST
📖 第 1 页 / 共 5 页
字号:
000106 e10f                      ldi     R16,0x1F
000107 bd01                      out     WDTCR,R16
000108 e00f                      ldi     R16,0x0F
000109 bd01                      out     WDTCR,R16
                 
00010a 9478                      sei
                 ;----- Debugging ----------------------------------------
                 
                 ;----- Main loop ----------------------------------------
00010b d004      Forever:        rcall   CheckEEP
00010c d112                      rcall   KeyCheck
00010d d011                      rcall   CheckMode
00010e 95a8                      wdr
00010f cffb                      rjmp    Forever 
                 ;--------------------------------------------------------
                 ;===== Checking EEPROM write ============================
000110 9100 0072 CheckEEP:       lds     R16,EEPflag
000112 3000                      cpi     R16,0x00
000113 f009                      breq    CheckEEP_1
000114 9508                      ret
000115 9100 0073 CheckEEP_1:     lds     R16,EEPwr
000117 3000                      cpi     R16,0x00
000118 f409                      brne    CheckEEP_2
000119 9508                      ret
00011a d21f      CheckEEP_2:     rcall   StoreEEP
00011b 2700                      clr     R16
00011c 9300 0073                 sts     EEPwr,R16
00011e 9508                      ret
                 ;===== Checking work mode ===============================
00011f 9100 0078 CheckMode:      lds     R16,AutoMode
000121 3000                      cpi     R16,0x00
000122 f011                      breq    AutoEnabled
000123 d022                      rcall   ProgStep
000124 9508                      ret
000125 9100 0071 AutoEnabled:    lds     R16,Endofprog
000127 3f0f                      cpi     R16,0xff
000128 f011                      breq    AutoEnabled_1
000129 d01c                      rcall   ProgStep
00012a 9508                      ret
00012b 2700      AutoEnabled_1:  clr     R16
00012c 9300 0071                 sts     Endofprog,R16
00012e 9100 0070                 lds     R16,LoopPrg
000130 950a                      dec     R16
000131 f021                      breq    AutoEnabled_2
000132 9300 0070                 sts     LoopPrg,R16
000134 d011                      rcall   ProgStep
000135 9508                      ret
000136 e00a      Autoenabled_2:  ldi     R16,LoopProg
000137 9300 0070                 sts     LoopPrg,R16
                 
000139 e9e8                      ldi     ZL,Low(ProgTab*2)
00013a e0f7                      ldi     ZH,High(ProgTab*2)
                 
00013b 9100 0079                 lds     R16,ProgNum
00013d 9114                      lpm     R17,Z
                 
00013e 9503                      inc     R16
00013f 1701                      cp      R16,R17
000140 f409                      brne    AutoEnabled_3
000141 2700                      clr     R16
000142 9300 0079 AutoEnabled_3:  sts     ProgNum,R16
000144 d001                      rcall   ProgStep
000145 9508                      ret
                 ;===== Program stepping =================================
000146 d010      ProgStep:       rcall   WaitSync
000147 9100 0075                 lds     R16,ProgBit
000149 9503                      inc     R16
00014a 9300 0075                 sts     ProgBit,R16
00014c f439                      brne    ProgStep_1
                 
00014d 9100 007a                 lds     R16,Microphone
00014f 3000                      cpi     R16,0x00
000150 f011                      breq    ProgStep_2
                 
000151 9b83                      sbis    PIND,PD3
                                 ;ret
000152 c001                      rjmp    ProgStep_1
                 
000153 d01b      ProgStep_2:     rcall   GetNextStep
000154 d046      ProgStep_1:     rcall   AdjValuesCh
000155 d094                      rcall   PWMmode
000156 9508                      ret
                 ;===== Wait syncronisation ==============================
000157 930f      WaitSync:       push    R16
000158 93ff                      push    ZH
000159 93ef                      push    ZL
                 
00015a e7eb                      ldi     ZL,Low(Speeds)
00015b e0f0                      ldi     ZH,High(Speeds)
00015c 9100 0079                 lds     R16,ProgNum
00015e 0fe0                      add     ZL,R16
00015f e000                      ldi     R16,0x00
000160 1ff0                      adc     ZH,R16
                 
000161 8100                      ld      R16,Z
                 
000162 91e0 006e WaitSync_1:     lds     ZL,IntFlag
000164 30e0                      cpi     ZL,0x00
000165 f3e1                      breq    WaitSync_1
000166 27ee                      clr     ZL
000167 93e0 006e                 sts     IntFlag,ZL
000169 950a                      dec     R16
00016a f7b9                      brne    WaitSync_1
                 
00016b 91ef                      pop     ZL
00016c 91ff                      pop     ZH
00016d 910f                      pop     R16
00016e 9508                      ret
                 ;===== Get next step ====================================
00016f 930f      GetNextStep:    push    R16
000170 931f                      push    R17
000171 93ff                      push    ZH
000172 93ef                      push    ZL
                 
000173 e9e8                      ldi     ZL,Low(ProgTab*2)
000174 e0f7                      ldi     ZH,High(ProgTab*2)
                 
000175 9100 0079                 lds     R16,ProgNum
000177 e010                      ldi     R17,0x00
000178 0fe0                      add     ZL,R16
000179 1ff1                      adc     ZH,R17
00017a 0fe0                      add     ZL,R16
00017b 1ff1                      adc     ZH,R17
                 
00017c 9632                      adiw    ZH:ZL,0x02
                 
00017d 9105                      lpm     R16,Z+
00017e 9115                      lpm     R17,Z+
00017f 2fe0                      mov     ZL,R16
000180 2ff1                      mov     ZH,R17
                 
000181 0fee                      add     ZL,ZL
000182 1fff                      adc     ZH,ZH
                 
000183 9114                      lpm     R17,Z
000184 9632                      adiw    ZH:ZL,0x02
000185 9100 0074                 lds     R16,ProgSt
000187 9503                      inc     R16
000188 1701                      cp      R16,R17
000189 f421                      brne    GetNextSt_1
00018a ef0f                      ldi     R16,0xff
00018b 9300 0071                 sts     Endofprog,R16
00018d 2700                      clr     R16
00018e 9300 0074 GetNextSt_1:    sts     ProgSt,R16
                 
000190 0fe0                      add     ZL,R16
000191 e010                      ldi     R17,0x00
000192 1ff1                      adc     ZH,R17
000193 9104                      lpm     R16,Z
000194 9300 0076                 sts     ProgValue,R16
                 
000196 91ef                      pop     ZL
000197 91ff                      pop     ZH
000198 911f                      pop     R17
000199 910f                      pop     R16
00019a 9508                      ret
                 ;===== Adjust value channels ============================
00019b 930f      AdjValuesCh:    push    R16
                 
00019c 9100 0076                 lds     R16,ProgValue
00019e 7001                      andi    R16,0x01
00019f f041                      breq    AdjVal_0
0001a0 9100 0068                 lds     R16,CntCh0
0001a2 3f0f                      cpi     R16,0xff
0001a3 f059                      breq    AdjVal_1
0001a4 9503                      inc     R16
0001a5 9300 0068                 sts     CntCh0,R16
0001a7 c007                      rjmp    AdjVal_1
0001a8 9100 0068 AdjVal_0:       lds     R16,CntCh0
0001aa 3000                      cpi     R16,0x00
0001ab f019                      breq    AdjVal_1
0001ac 950a                      dec     R16
0001ad 9300 0068                 sts     CntCh0,R16
                 AdjVal_1:
                 
                 
0001af 9100 0076                 lds     R16,ProgValue
0001b1 7002                      andi    R16,0x02
0001b2 f041                      breq    AdjVal_2
0001b3 9100 0069                 lds     R16,CntCh1
0001b5 3f0f                      cpi     R16,0xff
0001b6 f059                      breq    AdjVal_3
0001b7 9503                      inc     R16
0001b8 9300 0069                 sts     CntCh1,R16
0001ba c007                      rjmp    AdjVal_3
0001bb 9100 0069 AdjVal_2:       lds     R16,CntCh1
0001bd 3000                      cpi     R16,0x00
0001be f019                      breq    AdjVal_3
0001bf 950a                      dec     R16
0001c0 9300 0069                 sts     CntCh1,R16
                 AdjVal_3:
                 
0001c2 9100 0076                 lds     R16,ProgValue
0001c4 7004                      andi    R16,0x04
0001c5 f041                      breq    AdjVal_4
0001c6 9100 006a                 lds     R16,CntCh2
0001c8 3f0f                      cpi     R16,0xff
0001c9 f059                      breq    AdjVal_5
0001ca 9503                      inc     R16
0001cb 9300 006a                 sts     CntCh2,R16
0001cd c007                      rjmp    AdjVal_5
0001ce 9100 006a AdjVal_4:       lds     R16,CntCh2
0001d0 3000                      cpi     R16,0x00
0001d1 f019                      breq    AdjVal_5
0001d2 950a                      dec     R16
0001d3 9300 006a                 sts     CntCh2,R16
                 AdjVal_5:
                 
0001d5 9100 0076                 lds     R16,ProgValue
0001d7 7008                      andi    R16,0x08
0001d8 f041                      breq    AdjVal_6
0001d9 9100 006b                 lds     R16,CntCh3
0001db 3f0f                      cpi     R16,0xff
0001dc f059                      breq    AdjVal_7
0001dd 9503                      inc     R16
0001de 9300 006b                 sts     CntCh3,R16
0001e0 c007                      rjmp    AdjVal_7
0001e1 9100 006b AdjVal_6:       lds     R16,CntCh3
0001e3 3000                      cpi     R16,0x00
0001e4 f019                      breq    AdjVal_7
0001e5 950a                      dec     R16
0001e6 9300 006b                 sts     CntCh3,R16
                 AdjVal_7:
0001e8 910f                      pop     R16
0001e9 9508                      ret
                 ;===== PWM mode check ===================================
0001ea 930f      PWMmode:        push    R16
0001eb 9100 0077                 lds     R16,PWMflag
0001ed 3000                      cpi     R16,0x00
0001ee f091                      breq    NoPWMmode
                 
0001ef 9100 0068                 lds     R16,CntCh0
0001f1 9300 0064                 sts     ValCh0_,R16
0001f3 9100 0069                 lds     R16,CntCh1
0001f5 9300 0065                 sts     ValCh1_,R16
0001f7 9100 006a                 lds     R16,CntCh2
0001f9 9300 0066                 sts     ValCh2_,R16
0001fb 9100 006b                 lds     R16,CntCh3
0001fd 9300 0067                 sts     ValCh3_,R16
                 
0001ff 910f                      pop     R16
000200 9508                      ret
                 
000201 9100 0068 NoPWMmode:      lds     R16,CntCh0
000203 7800                      andi    R16,0x80
000204 f009                      breq    NoPWMmode_1
000205 ef0f                      ldi     R16,0xff
000206 9300 0064 NoPWMmode_1:    sts     ValCh0_,R16
                 
000208 9100 0069                 lds     R16,CntCh1
00020a 7800                      andi    R16,0x80
00020b f009                      breq    NoPWMmode_2
00020c ef0f                      ldi     R16,0xff
00020d 9300 0065 NoPWMmode_2:    sts     ValCh1_,R16
                 
00020f 9100 006a                 lds     R16,CntCh2
000211 7800                      andi    R16,0x80
000212 f009                      breq    NoPWMmode_3
000213 ef0f     

⌨️ 快捷键说明

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