I am using P16f88, I read in Dogim Ibrahim book on picbasic that I can use the int interrupt, or external interrupt. I would like to see example of such interrupts. I keep finding ASM, timer interrupt, but no external interrupts in picbasic pro![]()
I am using P16f88, I read in Dogim Ibrahim book on picbasic that I can use the int interrupt, or external interrupt. I would like to see example of such interrupts. I keep finding ASM, timer interrupt, but no external interrupts in picbasic pro![]()
Last edited by lerameur; - 25th November 2010 at 18:02.
Here is what I think are the best interrupts to use with PicBasic. They are called instant interrupts, or DT Interrupts. Here is a link and a few examples that should work with your chip, with possibly some minor adjustments.
http://darreltaylor.com/DT_INTS-14/intro.html
http://www.scalerobotics.com
Ok ok I found lots of stuff, RB0 seems to be the pin of choice for most Pic's. Just that in most example they are showing ONE mainloop, and say after the interrupt sequence is finish, the program return to the mainloop. Does it go to the mainloop, or does it go back where it left like a sub routine.. ???
K
PS I was making a while loop to go to a special menu. The while loop was looking for a external pin being activated. implementing that while loop everywhere made it nasty. I think as far as I can read, this is the best choice, external interrupt ! as soon the user pushes the button it goes to a menu. My only concern is, can I do anything in an interrupt ?, meaning I2C reading, looping, pausing, observing other pin values. Meaning can I use interrupt routine like I would a subroutine ???
Last edited by lerameur; - 25th November 2010 at 18:15.
The
at the end of the interrupt routine sends the code back to what it was doing when the interrupt was triggered.Code:@ INT_RETURN
Dave
Always wear safety glasses while programming.
Yes and no...My only concern is, can I do anything in an interrupt ?
It is normally best to get in and out of an interrupt as quick as possible.
Set a flag or increment a variable that will then be acted upon in the main program after the interrupt is finished.
Dave
Always wear safety glasses while programming.
eee ook, you mean something like:
/
RBO = 1 ' call interrupt
myInterrupt:
Gosub Display_menu
@int interrupt
Display_menu:
'display result on LCD....
return
/
WIll the return go back to the interrupt or back to where interrupt has left the main program ??
K
Here is exactly what I need.. I think
The programs records a multitude of time from an external timer.
When the user push Pushes Button-A (RB0), it will go to a menu where the user can see all the times. The user can push Again button-A, to see the next time, Pushes again for the following time until it reaches the end. If the Button-A is not press for 10 seconds, the menu exit and return to where it left off. Is this Clear ?? sometime it is clear to me but not to others
K
Hi Ken,
not exactly, when RB0 does = 1 it sets a flag bit and that bit stays set even if RB0 goes back to zero, your program does something of your choosing as a result and then it clears that flag bit before it resumes, assuming you write the code properly.
It returns to the next line normally.WIll the return go back to the interrupt or back to where interrupt has left the main program ??
Last edited by Archangel; - 25th November 2010 at 23:52.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks