Assuming you have TMR0 (8 bit timer) free, you can try this code
The minimum delay you will achieve will be 4T cycles or roughly 2uS at 8MHz.Code:AsmDelay macro delayus movlw 0FFh-delayus ; delayus to overflow 1T movwf TMR0 1T bcf INTCON, T0IF ; clear the timer0 Overflow flag 1T btfss INTCON, T0IF ; wait till it overflows 1T/2T goto $-1 ; back to the btfss 2T endm
The way to use it would be
I hope this takes you closer to your goal. The code is just a concept, you may have to correct it. One important point you should note - the maximum delay will be 255uSCode:GPIO = %01 @ AsmDelay 12 GPIO = %10 @ AsmDelay 24




Bookmarks