; 30-DEC-2000 Eric Smith ; changed for GPASM assembler ;6-JAN-2000 Richard Ottosen ;This routine is for the SX parts in Turbo mode only. It does not matter if the ; Carry fuse is set or clear. ; ;Macro to delay for M number of cycles from 0 through 65535. ; The macro includes paging for long calls. ; ;Uses the routine "DelW" to do the short delays and uses the variable "DelMCnt" ; as well for long delays. ;The constants 5 and 15 must be loaded into variables "Five" and "Fifteen" ; before DelM is used. ; ; DelM MACRO _MM IF LOW(_MM) ==0 ;No delay at all ENDIF IF LOW(_MM) ==1 NOP ;Delay 1 cycle inline ENDIF IF LOW(_MM) ==2 NOP ;Delay 2 cycles inline NOP ENDIF IF LOW(_MM) ==3 GOTO $+1 ;Delay 3 cycles inline ENDIF IF LOW(_MM) ==4 GOTO $+1 ;Delay 4 cycles inline NOP ENDIF IF LOW(_MM) ==5 GOTO $+1 ;Delay 5 cycles inline NOP NOP ENDIF IF LOW(_MM) ==6 GOTO $+1 ;Delay 6 cycles inline GOTO $+1 ENDIF IF LOW(_MM) ==7 ERRORLEVEL -306 PAGE Delay6 CALL Delay6 ;Delay 7 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==8 ERRORLEVEL -306 PAGE Delay7 CALL Delay7 ;Delay 8 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==9 ERRORLEVEL -306 PAGE Delay8 CALL Delay8 ;Delay 9 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==10 ERRORLEVEL -306 PAGE Delay9 CALL Delay9 ;Delay 10 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==11 ERRORLEVEL -306 PAGE Delay10 CALL Delay10 ;Delay 11 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==12 ERRORLEVEL -306 PAGE Delay11 CALL Delay11 ;Delay 12 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==13 ERRORLEVEL -306 PAGE Delay12 CALL Delay12 ;Delay 13 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==14 ERRORLEVEL -306 PAGE Delay13 CALL Delay13 ;Delay 14 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==15 ERRORLEVEL -306 PAGE Delay14 CALL Delay14 ;Delay 15 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) ==16 ERRORLEVEL -306 PAGE Delay15 CALL Delay15 ;Delay 16 cycles ERRORLEVEL +306 ENDIF IF LOW(_MM) >16 MOVLW LOW(_MM-1) ERRORLEVEL -306 PAGE DelW CALL DelW ;Delay for 17 thru 255 cycles ERRORLEVEL +306 ENDIF IF HIGH(_MM) !=0 LOCAL _DelMLoop MOVLW HIGH(_MM) ;Delay more for greater than 255 cycles MOVWF DelMCnt _DelMLoop MOVLW 251 ERRORLEVEL -306 PAGE DelW CALL DelW ERRORLEVEL +306 DECFSZ DelMCnt GOTO _DelMLoop ENDIF ENDM ; Eric Smith 7/8/96 Hacked by Richard Ottosen 8/8/99 ;----------------------------------------------------------------------------- ;This version of DelW is for the Scenix parts in Turbo mode. It does not matter ;if the Carry fuse is set or clear. ; DelW delays W cycles, including call, return, and one cycle for the ; MOVLW instruction to set up the count in W ; range is 16..255 ; ; For example, the sequence: ; MOVLW 17 ; CALL DelW ; will take 17 cycles to execute ;----------------------------------------------------------------------------- ; W value on entry: 16 17 18 19 20 21 22 23 ; Caller's instructions: --- --- --- --- --- ----- ----- ----- ; MOVLW n 0 0 0 0 0 0 0 0 ; CALL DelW 1 1 1 1 1 1 1 1 DelW BSF status,cf ; 4 4 4 4 4 4 4 4 SUBWF Fifteen,W ; 5 5 5 5 5 5 5 5 _DelWLp ADDWF Five,W ; 6 6 6 6 6 6 11 7 11 7 11 BTFSS status,cf ; 7 7 7 7 7 7 12 12 12 GOTO _DelWLp ; 8 8 8 BCF status,cf ; 9 9 9 9 9 14 14 14 ADDWF pcl ; 10 10 10 10 10 15 15 15 Delay10 NOP ; 13 Delay9 NOP ; 13 14 Delay8 NOP ; 13 14 15 18 Delay7 NOP ; 13 14 15 16 18 19 Delay6 RETP ; 13 14 15 16 17 18 19 20 ; 16 17 18 19 20 21 22 23 Delay15 NOP Delay14 NOP Delay13 NOP Delay12 NOP Delay11 GOTO Delay8
file: /Techref/scenix/lib/io/dev/video/delm_inc.htm, 4KB, , updated: 2001/4/17 11:13, local time: 2024/11/22 23:15,
3.12.34.209:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/scenix/lib/io/dev/video/delm_inc.htm"> scenix lib io dev video delm_inc</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.