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

📄 sinewave.lst

📁 Why your source code are not be used? 1.The content is too simple 2.Is not a sourcecode or docum
💻 LST
📖 第 1 页 / 共 3 页
字号:
0029 0567           00175         BSF    NoPower       ;-- Indicate that are not to switch lamp on!!
                    00176 
002A 0C3F           00177         MOVLW  MASK_OFF    ;-- Set up GPIO so GP3 won't cause a Wake from sleep
002B 0006           00178         TRIS   GPIO          ;-- But so Zero Cross (GP0) will Wake things Up
                    00179       
                    00180 
                    00181 
                    00182 
                    00183 ;**********************************************************************************
                    00184 ;   WAIT FOR ZERO CROSS INTERRUPT
                    00185 ;**********************************************************************************
                    00186 ;        MOVF   GPIO,W        ;-- Read the Pins ready for sleep
                    00187 ;        SLEEP                ;-- Wait for interrupt
002C                00188 SleepLoop
002C 0606           00189         BTFSC  ZeroCross
002D 0A2C           00190         GOTO   SleepLoop
                    00191        
                    00192 ;        MOVLW  0xFD          ;-- Output Short Pulse FOR DEBUG #################
                    00193 ;        TRIS   GPIO
                    00194 
                    00195 ;        MOVLW  MASK_OFF      ;-- On Wake Up from Sleep 
                    00196 ;        TRIS   GPIO          ;-- Set all Ports to INPUT
                    00197       
                    00198         
                    00199 ;**** Wait 3ms Until actual zero cross ****
                    00200 
                    00201 ;        MOVLW 0x0A
                    00202 ;        MOVWF Delay1
002E                00203 Dly3ms
002E 0C85           00204         MOVLW 0x85
002F 002C           00205         MOVWF Delay2
0030                00206 Dly3ms_1
Message[305]: Using default destination of 1 (file).
0030 02EC           00207         DECFSZ Delay2       ;-- 3 cycles per loop * 133  = approx 400us
0031 0A30           00208         GOTO   Dly3ms_1
MPASM 02.20.04 Intermediate  SINEWAVE.ASM   9-9-1999  11:21:06         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                    00209 ;        DECFSZ Delay1
                    00210 ;        GOTO   Dly3ms
                    00211 
                    00212 
                    00213 
                    00214      
                    00215 
                    00216  
                    00217 ;**********************************************************************************
                    00218 ;  Wait Loop - 39us Per Complete Loop 33uS Delay + 6us Counter
                    00219 ;
                    00220 ;  IMPORTANT - Zero Cross must be configured to fire at 36us Before Zero for
                    00221 ;  Timing to be correct!!!!.
                    00222 ;
                    00223 ;**********************************************************************************       
0032                00224 WaitLoop
                    00225            
                    00226       
                    00227 ;**********************************************************************************
                    00228 ; Delay33 - This routine delays for 33uS and checks key status at same time
                    00229 ;**********************************************************************************
0032                00230 Delay33
                    00231        ;****** Check the Up 1% Pin ******
0032                00232 UPStart
0032 07A6           00233        BTFSS   UpButton     ; Check if button PIN held LOW
0033 0507           00234        BSF     UpFlag       ; Indicate that button "HIGH"
0034 0607           00235        BTFSC   UpFlag       ; Check If Button Flag is 1
0035 07A6           00236        BTFSS   UpButton     ; Check If button Pin has been released
0036 0A3A           00237        GOTO    UpEnd        ; If Flag not 1 or Button not released then skip to end
Message[305]: Using default destination of 1 (file).
0037 02A8           00238        INCF    Power        ; Increase the power output
0038 0407           00239        BCF     UpFlag       ; Clear the Flag
0039 0A3D           00240        GOTO    DownStart    ; Go to Next button check
003A                00241 UpEnd
003A 0000           00242        NOP                  ; Delay to give even time cycles for different directions
003B 0000           00243        NOP                  ; So that the total time taken does not change
003C 0000           00244        NOP                  ; to give an equal delay of 8 Cycles each time executed
                    00245 
                    00246        ;****** Check the Down 1% Pin ******
003D                00247 DownStart
003D 0786           00248        BTFSS   DownButton   ; Check if button PIN Held LOW
003E 0527           00249        BSF     DownFlag     ; Indicate that button "HIGH"
003F 0627           00250        BTFSC   DownFlag     ; Check If Button Flag is 1
0040 0786           00251        BTFSS   DownButton   ; Check If button Pin has been released
0041 0A45           00252        GOTO    DownEnd      ; If Flag not 1 or Button not released then skip to end
Message[305]: Using default destination of 1 (file).
0042 00E8           00253        DECF    Power        ; Decrease the power output
0043 0427           00254        BCF     DownFlag     ; Clear the Flag
0044 0A49           00255        GOTO    OnStart      ; Go to Next button check
0045                00256 DownEnd
0045 0000           00257        NOP                  ; Delay to give even time cycles for different directions
0046 0000           00258        NOP                  ; So that the total time taken does not change
0047 0000           00259        NOP                  ; to give an equal delay of 8 Cycles each time executed
MPASM 02.20.04 Intermediate  SINEWAVE.ASM   9-9-1999  11:21:06         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                    00260 
                    00261        ;****** Check the FULL POWER pin *****
0048 0C64           00262        MOVLW  0x64          ; Load 100% Value into W - Just in case its needed
0049                00263 OnStart
0049 0766           00264        BTFSS  OnPin         ; Check if On Pin is held LOW
004A 0028           00265        MOVWF  Power         ; If pin ON then load 100% into Power Register
                    00266       
004B                00267 OffStart
004B 0746           00268        BTFSS  OffPin        ; Check if Off Pin is held LOW
004C 0068           00269        CLRF   Power         ; Clear the Power Register - i.e. Set it to Zero.
                    00270        
                    00271        ;----------- 22 Instruction Cycles to Here from start of delay --------------       
                    00272       
                    00273        ;****** Check if value is -1 (i.e less than zero ******
004D 0208           00274        MOVF   Power,W       ; Load power into W
004E 0FFF           00275        XORLW  0xFF          ; OR with 256 (-1) if result == Zero then is equal to 256
004F 0643           00276        BTFSC  STATUS,Z      ; Check the Zero Flag
0050 0068           00277        CLRF   Power         ; If Zero flag was set then Clear the power setting (i.e set to zero %)
                    00278        
                    00279        ;****** Check if Value is  > 100%
0051 0C64           00280        MOVLW  0x64          ; Load 100% into Reg for checking if > 100%
0052 0088           00281        SUBWF  Power,W       ; Subtract 100 from Power Rating
0053 0703           00282        BTFSS  STATUS,C      ; Check if result +ve of -ve
0054 0A58           00283        GOTO   MaxEnd_1      ; result was positive so no need to adjust the setting
0055 0C64           00284        MOVLW  0x64          ; Result -ve so adjust the power 
0056 0028           00285        MOVWF  Power         ; 
0057 0A59           00286        GOTO   Max_End
0058                00287 MaxEnd_1
0058 0000           00288        NOP                  ; Timing Adjustment So Timing always the same
                    00289       
0059                00290 Max_End
                    00291        
0059 0000           00292        NOP
                    00293              
                    00294 ;    ;------------ 33 Instruction Cycles to this point from start of the delay -------
                    00295  
                    00296 ;****************************** END OF Delay33
                    00297       
Message[305]: Using default destination of 1 (file).
005A 02E9           00298       DECFSZ Count           ;-- Dec Counter 
005B 0A61           00299       GOTO   WaitCheck       ;-- If not zero then wait another period
005C 0667           00300       BTFSC  NoPower         ;-- If NoPower bit set then do not ouput anything
005D 0A61           00301       GOTO   WaitCheck       ;-- If Bit Set then Skip toggling Port
005E 0C3D           00302       MOVLW  MASK_ON         ;-- Load Tris to turn output ON
005F 0006           00303       TRIS   GPIO            ;-- Lower it!!
0060 0567           00304       BSF    NoPower         ;-- Indicate that have lowered pin
0061                00305 WaitCheck
Message[305]: Using default destination of 1 (file).
0061 02EA           00306       DECFSZ CountTotal      ;-- Dec Total Time Cycle
0062 0A32           00307       GOTO   WaitLoop        ;-- If not zero Then keep Looping until all done
0063 0A1A           00308       GOTO   MainLoop        ;-- else restart the main loop
                    00309 
                    00310 
MPASM 02.20.04 Intermediate  SINEWAVE.ASM   9-9-1999  11:21:06         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                    00311 
                    00312 
                    00313 
                    00314 
                    00315 ;**********************************************************************************
                    00316 ; PowerTable - The table for even power slices of a sine wave  (101 Words)
                    00317 ;              Using 39uS as the Time base.
                    00318 ;              Table has been reversed so that 100% power output is last in table
                    00319 ;              and Zero Power Output is First in the table
                    00320 ;**********************************************************************************
0064                00321 PowerTable:
Message[305]: Using default destination of 1 (file).
0064 01E2           00322     ADDWF PCL      ;-- Add Offset to PC to generate computed jump
                    00323 
0065 08FF           00324     RETLW 0xFF     ;-- 0% Output Power 
0066 08EF           00325     RETLW 0xEF     ;-- 1% Output Power
0067 08E8           00326     RETLW 0xE8     ;-- 2% Output Power
0068 08E3           00327     RETLW 0xE3     ;-- 3% Output Power
0069 08DF           00328     RETLW 0xDF     ;-- 4% Output Power
006A 08DB           00329     RETLW 0xDB     ;-- 5% Output Power
006B 08D7           00330     RETLW 0xD7     ;-- 6% Output Power
006C 08D4           00331     RETLW 0xD4     ;-- 7% Output Power
006D 08D1           00332     RETLW 0xD1     ;-- 8% Output Power
006E 08CE           00333     RETLW 0xCE     ;-- 9% Output Power
006F 08CB           00334     RETLW 0xCB     ;-- 10% Output Power
0070 08C8           00335     RETLW 0xC8     ;-- 11% Output Power
0071 08C6           00336     RETLW 0xC6     ;-- 12% Output Power
0072 08C3           00337     RETLW 0xC3     ;-- 13% Output Power
0073 08C1           00338     RETLW 0xC1     ;-- 14% Output Power
0074 08BF           00339     RETLW 0xBF     ;-- 15% Output Power
0075 08BD           00340     RETLW 0xBD     ;-- 16% Output Power
0076 08BA           00341     RETLW 0xBA     ;-- 17% Output Power
0077 08B8           00342     RETLW 0xB8     ;-- 18% Output Power
0078 08B6           00343     RETLW 0xB6     ;-- 19% Output Power
0079 08B4           00344     RETLW 0xB4     ;-- 20% Output Power
007A 08B2           00345     RETLW 0xB2     ;-- 21% Output Power
007B 08B0           00346     RETLW 0xB0     ;-- 22% Output Power
007C 08AE           00347     RETLW 0xAE     ;-- 23% Output Power
007D 08AC           00348     RETLW 0xAC     ;-- 24% Output Power
007E 08AA           00349     RETLW 0xAA     ;-- 25% Output Power
007F 08A9           00350     RETLW 0xA9     ;-- 26% Output Power
0080 08A7           00351     RETLW 0xA7     ;-- 27% Output Power

⌨️ 快捷键说明

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