Hey,
I can't seem to get TMR0 to work. This is just a program I'm playing around with it, trying to get it to work.
Pushing the button works, but the timer doesn't and I can't figure out why!
Any help is greatly appreaciated,
Thanks
I can't seem to get TMR0 to work. This is just a program I'm playing around with it, trying to get it to work.
Code:
org 0x00
goto program
org 0x04
bcf INTCON,2
goto skip
program
bsf STATUS, RP0 ;changes banks
movlw b'00001111' ;0-4inputs 5,6outputs
movwf TRISIO ;setting input/output (1=input)
bcf STATUS, RP0 ;changes banks
movlw .7 ;turns off comparators
movwf CMCON ;turns off comparators
movlw b'00000000' ;setting high/low (1=high)
movwf GPIO ;setting high/low (1=high)
bsf GPIO,4
bsf GPIO,5
bsf INTCON,7 ;enables global interrupts
bsf INTCON,4 ;enables edge interrupt
bsf INTCON,5 ;enables TMR0
movlw d'16'
movwf TMR0
loop
bcf GPIO,4
goto loop
skip
bcf GPIO,5
bcf GPIO,4
goto skip
end
Pushing the button works, but the timer doesn't and I can't figure out why!
Any help is greatly appreaciated,
Thanks