|
|
View previous topic :: View next topic |
Author |
Message |
[email protected]
Joined: 16 May 2006 Posts: 39
|
2 RS232 in Pic18F1220 |
Posted: Tue Aug 22, 2006 6:49 am |
|
|
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
|
|
Posted: Tue Aug 22, 2006 8:30 am |
|
|
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 |
|
|
|
|
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
|