A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Interrupt on pics18 - musabbirmajeed - Feb 18 9:02:48 2009
Dear all,
I am currently working on pic mcu, and I am using the External
Interrupt facility provided on the IO PORT B of the pic
microcontroller. I have written the code, which logically, I think is
correct. But, it is not producing the desired output.
Basically, I am trying to change the state of the io pins when the
interrupt occurs. When, I am sending the data via serial port, it is
arriving on the interrupt pin, but it is not changing the state of the
other IO pin as instructed by the code. A very small segment of my
code is given below:
void INT0_isr(void) {
//SelectPin = ~SelectPin;
SelectPin = 0; //select pin is an io pin
Delay10KTCYx(100);
INTCONbits.INT0IF =0; //clears the flag, so, that the interrupt can
occur again
transmit = receive;
SelectPin = 1;
}
I am quite confident that I have correctly used the INTCON registers
and the bits involved in that registers like GIE, INT01E etc.
Any suggestions or any advice from the past experiences will be really
appreciated.
Hope to hear from you soon.
Best Regards,
Musabbir
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interrupt on pics18 - Harold Hallikainen - Feb 18 10:19:41 2009
> Dear all,
>
> I am currently working on pic mcu, and I am using the External
> Interrupt facility provided on the IO PORT B of the pic
> microcontroller. I have written the code, which logically, I think is
> correct. But, it is not producing the desired output.
>
> Basically, I am trying to change the state of the io pins when the
> interrupt occurs. When, I am sending the data via serial port, it is
> arriving on the interrupt pin, but it is not changing the state of the
> other IO pin as instructed by the code. A very small segment of my
> code is given below:
>
> void INT0_isr(void) {
> //SelectPin = ~SelectPin;
> SelectPin = 0; //select pin is an io pin
> Delay10KTCYx(100);
> INTCONbits.INT0IF =0; //clears the flag, so, that the interrupt can
> occur again
> transmit = receive;
> SelectPin = 1;
> }
> I am quite confident that I have correctly used the INTCON registers
> and the bits involved in that registers like GIE, INT01E etc.
>
> Any suggestions or any advice from the past experiences will be really
> appreciated.
>
> Hope to hear from you soon.
> Best Regards,
> Musabbir
Have you put any code at the interrupt vector to direct the processor to
your ISR? What PIC are you using? Also, are you doing a context save and
restore on going in to and out of the interrupt? If you're running a
debugger, you can set a breakpoint on the interrupt vector and single step
through your code.
Good luck!
Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interrupt on pics18 - chadrussel - Feb 21 13:00:24 2009
If you are using Port B "Interrupt on Change" feature, do not forget
to read the port in order to reset the change flag before returning
from your Interrupt Service Routine.
--- In p...@yahoogroups.com, "musabbirmajeed"
wrote:
>
> Dear all,
>
> I am currently working on pic mcu, and I am using the External
> Interrupt facility provided on the IO PORT B of the pic
> microcontroller. I have written the code, which logically, I think is
> correct. But, it is not producing the desired output.
>
> Basically, I am trying to change the state of the io pins when the
> interrupt occurs. When, I am sending the data via serial port, it is
> arriving on the interrupt pin, but it is not changing the state of the
> other IO pin as instructed by the code. A very small segment of my
> code is given below:
>
> void INT0_isr(void) {
> //SelectPin = ~SelectPin;
> SelectPin = 0; //select pin is an io pin
> Delay10KTCYx(100);
> INTCONbits.INT0IF =0; //clears the flag, so, that the interrupt can
> occur again
> transmit = receive;
> SelectPin = 1;
> }
> I am quite confident that I have correctly used the INTCON registers
> and the bits involved in that registers like GIE, INT01E etc.
>
> Any suggestions or any advice from the past experiences will be really
> appreciated.
>
> Hope to hear from you soon.
> Best Regards,
> Musabbir
>
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )