And the problem is....?
The interrupt should only happen when INT0 is triggered.
For multiple switch, you may need to use Int On change (RBC_INT) ... or poll them in a Timer Interrupt.
And the problem is....?
The interrupt should only happen when INT0 is triggered.
For multiple switch, you may need to use Int On change (RBC_INT) ... or poll them in a Timer Interrupt.
Last edited by mister_e; - 29th May 2008 at 21:55.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
i've edited my previous post. Also, let's say you want to use INT0 (RB0), you want to disable the multiplexed ADC on it (see ADCON1 register pdf page 155).
INT_INT will work only with RB0, while RBC_INT will work with PORTB<7:4> pins (see INTCON page 25, and section 5.2 page 58).
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Wow that was quick reply Mister_E!
Yes, checked the PDF pg 155, but isn't ADCON1 = 15 doing that?
That should make all ports digital?
I agree the port change 7:4 would be better, but I plan to use RB5 for CCP3...so that is not really possible. I think I should use the RB0 external interrupt.
"Never under estimate the powers of an idiot"
Nah... you can use whatever spare I/O you have, and poll them with a Timer Interrupt, let's say 10 times/seconds. Your main loop just check if you have a new keypress.
1 Timer interrupt will do everything,
1. scan the Key
2. say if there's a new key available,
3. and... why not using it also for the debouncing as well?
Think about it... 10 times a second is usually just fine.
<hr>
Yes ADCON1=15 will do.
Last edited by mister_e; - 29th May 2008 at 22:19.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Many thanks Mister_E...after much hair tearing I successfully managed to use the external RB0 interrupt with the above code. My stupid mistake, bad home made connector wiring on the EasyPIC board.
I ended up using your suggestion with the 10Hz timer -your multi-calculator works great! - as you said at least i can also debounce easily.
Many thanks for your time.
"Never under estimate the powers of an idiot"
The advantage of the timer interrupt is that you have a Global key scan... all the time, you just need to poll few variables it here and there. Another great thing.. you can use the pin you want. For user Key, it's just perfect and really fast enough.
Timer interrupt are sooo handy.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks