weg22
Joined: 08 Jul 2005 Posts: 91
|
How to use 2 UARTs at the same time (HW interrupts)?? |
Posted: Tue Jun 20, 2006 10:52 am |
|
|
Hi all,
I'm using a PIC18F8722 which has two hardware interrupts. I'm just wondering what the proper way is to read in data using these 2 interrupts. I know for one hardware interrupt, it should be:
Code: |
#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7, stream=IMU, DISABLE_INTS)
// RS232 interrupt for IMU
#int_rda
void rda_isr(void)
{
c = fgetc(IMU);
}
|
but now with 2 hardware devices attached, how would I go about this...something like below maybe? I just don't know that with both interrupts defined as INT_RDA, how it will know how to go to isr when receiving data from IMU, and isr2 when receiving data from GPS.
Code: |
#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7, stream=IMU, DISABLE_INTS)
#use rs232(baud=9600, xmit=PIN_G1, rcv=PIN_G2, stream=GPS, DISABLE_INTS)
// RS232 interrupt for IMU
#int_rda
void rda_isr(void)
{
c1 = fgetc(IMU);
}
// RS232 interrupt for GPS
#int_rda
void rda_isr_2(void)
{
c2 = fgetc(GPS);
}
|
Thanks in advance,
weg |
|