dHPorter
Newbie level 2
Hey, I'm new to forums in general so I apologize if I have any faux pas's (not sure how to make that plural).
I've been stuck on a program for the past week, using a PIC 16F88 and PicBasic Pro. I'm trying to run a program while being able to keep track of time using interrupts. I've looked at similar posts on this, but could not gain much from them.
I've tried this program to check if the interrupts are working, but no matter how I change the prescaler, I always get alternating 20 ms high, 10 ms low on the LED.
The Counter variable is meant to count seconds, but I haven't gotten far enough to actually use it yet. Any insight would be greatly appreciated.
I've been stuck on a program for the past week, using a PIC 16F88 and PicBasic Pro. I'm trying to run a program while being able to keep track of time using interrupts. I've looked at similar posts on this, but could not gain much from them.
I've tried this program to check if the interrupts are working, but no matter how I change the prescaler, I always get alternating 20 ms high, 10 ms low on the LED.
DEFINE OSC 8 'Internal RC Oscillator at 8 MHz
OSCCON.4 = 1
OSCCON.5 = 1
OSCCON.6 = 1
OPTION_REG.3 = 0 'Prescaler to TMR0
OPTION_REG.2 = 1 '1:256
OPTION_REG.1 = 1
OPTION_REG.0 = 1
INTCON.7 = 1 'Enable interrupts
INTCON.5 = 1 'Enables TMR0 interrupt
INTCON.2 = 0 'TMR0 overflow interrupt (not active)
led var porta.1
Counter var word
Counter = 0
i var byte
Main:
high led
goto main
disable
ClockInt:
for i = 0 to 2
low led
pause 1000
high led
pause 1000
next i
Counter = Counter + 1
INTCON.2 = 0
Resume
enable
End
The Counter variable is meant to count seconds, but I haven't gotten far enough to actually use it yet. Any insight would be greatly appreciated.