View previous topic :: View next topic |
Author |
Message |
Lorenzo
Joined: 23 Apr 2004 Posts: 14 Location: Pescara (Italy)
|
RDA vs EXT |
Posted: Wed Jul 14, 2004 1:47 am |
|
|
I use a 16F648A with PCW 3.157.
In my program there's a isr for USART rx and it works well.
If in the program I add isr for external interrupt than the isr_RDA doesn't work.
This is true also if I don't enable ext interrupt.
This works:
Code: | ....
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
...
} |
This doesn't work:
Code: | ....
int_EXT
isr_ext{
}
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
//enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
} |
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Jul 14, 2004 2:03 am |
|
|
Edited: Obsolete remark removed.
Last edited by ckielstra on Wed Jul 14, 2004 2:34 am; edited 1 time in total |
|
|
carlosma
Joined: 24 Mar 2004 Posts: 53 Location: Portugal
|
|
Posted: Wed Jul 14, 2004 2:19 am |
|
|
Hello Lorenzo:
I have a program with 2 Uart and works fine
I think your program need some alterations
see the example:
Code: |
#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7, STREAM=COM_B, ERRORS) //hardware
#USE RS232(BAUD=9600, XMIT=PIN_B1, RCV=PIN_B0, STREAM=COM_A)//software
....
#int_EXT
isr_ext()
{
//...
}
#int_RDA
isr_rda()
{
//...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
}
|
|
|
|
Ttelmah Guest
|
Re: RDA vs EXT |
Posted: Wed Jul 14, 2004 7:15 am |
|
|
Lorenzo wrote: | I use a 16F648A with PCW 3.157.
In my program there's a isr for USART rx and it works well.
If in the program I add isr for external interrupt than the isr_RDA doesn't work.
This is true also if I don't enable ext interrupt.
This works:
Code: | ....
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
...
} |
This doesn't work:
Code: | ....
int_EXT
isr_ext{
}
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
//enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
} |
|
There is no visible 'software' reason why what you describe wouldn't work. The most likely problems, are if there is noise on the external interrupt signal, so it is being effectively continuously triggered, which is then preventing the second interrupt handler being called, or that the handler for the external event has a fault, resulting in the processor staying in this routine for a long time (post the code). Interrupt routines _must_ in general be short. If (for instance), the external handler was taking several mSec to execute, then the hardware UART, could well have experienced a comm overrun error, and will hang, if this is not cleared (either by you, or using the 'ERRORS' option in the RS232).
Best Wishes |
|
|
Lorenzo
Joined: 23 Apr 2004 Posts: 14 Location: Pescara (Italy)
|
|
Posted: Wed Jul 14, 2004 8:37 am |
|
|
There isn't noise and however the EXT interrupt is disabled. |
|
|
Ttelmah Guest
|
|
Posted: Wed Jul 14, 2004 9:05 am |
|
|
Lorenzo wrote: | There isn't noise and however the EXT interrupt is disabled. |
As I said, _post the code_.
What you have posted so far, will work. Hence there is something else causing the problem.
Adding the second handler, only increases the latency for the RS232 interrupt by about five instruction cycles, but if (for instance), you are running with a slow clock, or a very high interrupt rate, this could be significant.
Best Wishes |
|
|
Guest
|
|
Posted: Wed Jul 14, 2004 11:25 am |
|
|
Maybe it's just a typo but you don't have '#' right before the int:
#int_ext
#int_rda |
|
|
|