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 support@ccsinfo.com

2 RS232 in Pic18F1220

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
info@ckmintech.com



Joined: 16 May 2006
Posts: 39

View user's profile Send private message

2 RS232 in Pic18F1220
PostPosted: Tue Aug 22, 2006 6:49 am     Reply with quote

I need to set up 2 com ports, COM1 and COM2. COM1 will read data only while COM2 will send data only.

I can use hardware UART rs232 and 1 software rs232 to do the job.

Can I use the hardware UART PIN_B4 for COM1 to read data while using UART PIN_B1 to send data?


// pin_a0 is a dummy pin, pin_b4 is hardware UART rec pin
#use rs232(baud=9600, rcv=pin_b4, xmit=pin_a0,stream=COM1)
// pin_a1 is a dummy pin, pin_b1 is hardware UART xmit pin
#use rs232(baud=9600, xmit=pin_b1, rec=pin_a1,stream=COM2)
Ttelmah
Guest







PostPosted: Tue Aug 22, 2006 8:30 am     Reply with quote

Why?.....
When you setup a UART, you get two seperate 'sets' of I/O functions. One set, handles sending (putc, etc.), while the other handles reading (getc gets etc.).
Just setup the one hardware UART, and use the functions. You seem to be trying to make a simple problem complex!.
If you want to give the two 'directions' symbolic names to make the distinction obvious, then just use #define, to give suitable names.

Best Wishes
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