CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to use 2 UARTs at the same time (HW interrupts)??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
weg22



Joined: 08 Jul 2005
Posts: 91

View user's profile Send private message

How to use 2 UARTs at the same time (HW interrupts)??
PostPosted: Tue Jun 20, 2006 10:52 am     Reply with quote

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
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Tue Jun 20, 2006 11:15 am     Reply with quote

The 2 RDA interrupts have different names. If you have the PCW (windows) compiler, use the View -> Valid Interrupts tool. It comes up with two RS232 receive interrupts: RDA and RDA2.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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