Like Tabsoft wrote, you generally want your DEFINEs at the top of the program but it's for readabillity. In reallity it makes no difference because they are not runtime commands.
Another little...
Type: Posts; User: HenrikOlsson; Keyword(s):
Like Tabsoft wrote, you generally want your DEFINEs at the top of the program but it's for readabillity. In reallity it makes no difference because they are not runtime commands.
Another little...
You can use the ADC to sample the voltage but the PIC needs to be awake for the ADC to operate and, again, the ADC doesn't run continously and can not automatically generate an interrupt when a given...
Hi Rob,
The IOC trips the interrupt on any change of the state on a digital pin. An interrupt will trip when the pin goes low and again when the pin goes high - provided you read the state of the...
Hi,
You're quite right, it's because you're using the IOC (Interrupt On Change), it'll trip the interrupt both when you push the button and when you release the button. (As well as on all the edges...
Hi,
No debounce may very well be part of the problem but in THIS case I think the contact bounce is what actually makes it sort of "work".
The real issue, I believe, is that your "loops" looks for...
Hi,
Another aproach is to use the interrupt mechanism as a way to "latch" the buttonpress but then not actually enable the interrupt itself but instead poll the interrupt flag to determine if the...
Hi Rob,
Even though that would work for this particular application that's generally not what you want to do (ie stay in the interrupt routine). Instead you do as I showed earlier, use a...
Hi Rob,
There are several ways - as is the case most of the time.
Interrupts are probably the way to go but there may be other ways.
Do you have a particular chip in mind, is it still the...
Hi,
MCLR is disabled by clearing the correct "fuse" in the CONFIG word. With PBP3 you set the CONFIG word(s) with the #CONFIG/#ENDCONFIG compiler directives (more on that in the manual). Your PBP3...
Hi Rob,
If you want the button to enable/disable the blining LED then you can't toggle the LED itself in the interrupt and then just continue to blink it in the main program loop. What you need is...
Hi,
> what if I wanted to run a different command to just turning on the LED
Don't understand this one, sorry...
> what about if I wanted to start the LED flashing upon button tap?
Well, yes....
Hi Rob,
Welcome to the forum! As you can imaging there are several ways to do this (and most other things). Amoque shows you one, here's another (which also tries to take care of the debounce):
...