Hi everyone.
Struggling a bit (well quite a bit actually) with the second / third parts of the project.
The brief says:
Then make a BYTE size variable and add the PBP interrupt routine for another LED. The new variable will increment a value of 1 every time the interrupt "triggers".
Ok, so what I'm trying to do here is to use the INTERRUPT flag as my counter (INTCON.2=1) I've set the prescaler at 1:256 = 65536us = 7.6HZ and set 'I' as a VAR BYTE.
My theory goes something like this:
If count (VAR BYTE 'I' incremented by the INTERRUPT flag) = 10 then TOGGLE the LED.
Here's how I'm trying to do it and where I'm falling down.
Code:
IF INTCON.2=1 ' INTERRUPT flag overflows
THEN I = I + 1 ' add 1 to the value of I.
INTCON.2=0 ' Reset the overflow flag.
IF I<=10 GOTO MAIN ' If count doesn't = 10 loop again.
IF I =10 GOTO TOG ' If count = 10 then TOGGLE the LED.
I'm thinking at 10 'counts' at 7.6HZ should be approximately blink the LED once a second-ish.
All a bit fragmented I know but I hope what on saying is on the right tracks.
Any thoughts, pointers?
Dave
Bookmarks