gnupic@linuxhacker.org
gnupic@linuxhacker.org
I've written a routine like this in PIC assembly:
Delay10MS
movwf temp1 ; Remember user-specified wait
bcf INTCON,T0IE ; Disable the TMR0 interrupt, we're polling instead
movlw b'10000111'
bsf STATUS,RP0 ; Select Bank 1
movwf OPTION_REG
bcf STATUS,RP0 ; Select Bank 0
delayFor10ms
movlw d'217' ; 10 ms = 10e6 us / 256 = ~39 ticks of Timer 0
movwf TMR0
bcf INTCON,T0IF ; Clear the interrupt flag
btfss INTCON,T0IF
goto $-1 ; Loop until Timer 0 overflows
bcf INTCON,T0IF
decfsz temp1,F ; We need to delay 10 ms multiple times
goto delayFor10ms
return
But I'd like to call it from SDCC's C. Can anyone tell me how to do
this? I suppose it wouldn't be that hard to re-write in C, but I'd like
to learn how to do this properly.
TIA,
--
Rick
gnupic@linuxhacker.org