UMCUserCodeDelayLoop

SwordfishUser.UMCUserCodeDelayLoop History

Hide minor edits - Show changes to output

August 21, 2011, at 01:06 PM by David Barker -
Added lines 1-22:
 [USERCODE]

 ;======================
 ; delay loop
 ;======================
 ; used for powerup delay, pll turn on, etc
 ;#define DELAY_LOOP 1

 #ifdef DELAY_LOOP
 errorlevel -207            ; disable 'label not in column 1 warning'
 #define START_DELAY 200
 #define DelayCount Index    ; alias Index as DelayCount

    movlw  START_DELAY
    movwf  DelayCount
    movlw  0
 MsDelayLoop:
    addlw  1
    bnz    MsDelayLoop    ; 3 cycles x 256 = 768 cycles
    decfsz  DelayCount      ; START_DELAY * 768 instruction cycles total (approx)
    goto    MsDelayLoop
 #endif