|
|
View previous topic :: View next topic |
Author |
Message |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
18F252 Serial Interrupt |
Posted: Tue Mar 30, 2004 4:06 pm |
|
|
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#int_RDA
void RDA_isr(){
status = getc();
}
void main () {
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
}
I had this working fine all day, now it will not interrupt. I know my data is transmitting out and I see the response on the scope, however, the interrupt is not doing it. Are there some bits I need to check to clear errors etc??? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 30, 2004 4:42 pm |
|
|
You can add the Errors directive to the #use rs232 statement. Example:
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8, ERRORS)
|
I hope that's not your entire program. If you let it fall off the end
of main(), it will hit a sleep instruction, inserted by the compiler,
and go to sleep. Then upon getting an RDA interrupt, it will wake up,
service the interrupt, and then begin execution of code after the
SLEEP instruction. Only, what code is after that point ? NOPs ?
or garbage ? It's best to prevent this by putting a while(1);
statement right before the end of main(). |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Tue Mar 30, 2004 4:47 pm |
|
|
I just wanted to show all the major lines of code needed. I realize that is not a complete program. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|