4 X RS-232 on a PIC

Sep 23, 2006 2 Replies

Hi,



I want to ask expert advise how can I have four RS232 interface on a single PIC microcontroller?



(I'm planning to use PIC18F6680 on SBC68EC board from Modtronix,

formatting link
Thanks,



Miem Chan miemchan at gmail . com



Miem -

Use the preprocessor directive (at least for PIC C compiler) "#use RS232()." For example, here are 3 RS232 interfaces:

#use RS232(baud = 9600, xmit=PIN_A2, rcv=PIN_A3, Stream=My_Data_A) #use RS232(baud = 9600, xmit=PIN_B2, rcv=PIN_B3, Stream=My_Data_B) #use RS232(baud = 9600, xmit=PIN_C2, rcv=PIN_C3, Stream=My_Data_C)

Then use the appropriate "Stream" for addressing the port you want in your code. For example: fprintf(My_Data_A, "Port A test\n\r"); should send the string "Port A test" out on Pin_A2.

Of course, the pins above have to be changed to suit what is available for you specific chip/design, the baud rate may be different, and I have no idea about the PIC resources needed to do this.

HTH, Bill

Hi Bill,

Thank you for the information. I am new to PIC programming. I've googled the #use RS232(..) macro and found that it is available in CCS's PIC C compiler. Due to studet budget constraints, I want to use MICROCHIP's MPLAB environment with Microchip's C compiler. Do you know if there is an equivalent of #use RS232(...) in Microchip's C compiler?

Thank you

Miem Chan

miemchan at gmail dot com

Bill wrote:

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required