i am currently using pic16f84a and a 4mhz external oscillator...i have a code for making a delay using tmr0 but it is'nt accurate.
i am also using 1:2 prescaler
here is the code:
-------------------------------------------------------------
list p=16f84a
#include <p16f84a.inc>
bsf status, rp0
clrf trisb
movlw 0f0h
movwf trisa
movlw b'10111000' ; prescaler 1:2
movwf option_reg
bcf status,rp0
main
..
..
..
..
call delay
..
..
..
delay
movlw 0a1h
movwf b
movlw 07h
movwf c
movlw 96 ; decimal
movwf TMR0
test
btfss TMR0,7 ; test if TMR0 has reached 256 cycles (128 beats in prescaler)
goto test ;increment TMR0
bcf TMR0,7 ;clear bit 7 only so that the other bits will not be affected
decfsz b,1
goto test
decfsz c,1
goto test
return
-----------------------------------------------
-the code is'nt accurate because 2 sets of two cycles will be disregarded; the call and return function
help please..