View previous topic :: View next topic |
Author |
Message |
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
Printf on UART2 |
Posted: Thu Jan 29, 2004 2:57 pm |
|
|
Hi.
I am using a PIC6720 with 2 hardware uarts. My question is how do I send data on UART2, as it defaults to UART1
I looked through the manual and could not find any reference to how to deal with the two different uarts, other than for receiving, which I don't have a problem with.
thanks in advance
Kasper
Code: |
#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use rs232(baud=38400,parity=N,xmit=PIN_G1,rcv=PIN_G2,bits=8)
|
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
Using Two UARTS |
Posted: Thu Jan 29, 2004 3:19 pm |
|
|
You need to use the Stream= parameter with USE_RS232 then designate the Stream name within the serial command (FGETC, PUTC, sprintf etc).
See the manual page 59 for more info on the Stream= parameter then search this site for the word Stream and you will find a lot of examples...I have included an abbreviated example below.
*************
#use rs232(baud=9600,xmit=PIN_C6,
rcv=PIN_C7,stream=PORT1,errors)
#use rs232(baud=4800,xmit=PIN_B1,
rcv=PIN_B0,stream=PORT2)
**********
if (kbhit(PORT1))
{
BUFFER_1[i1] = fgetc(PORT1);
i1++;
}
....
if (kbhit(PORT2))
{
BUFFER_2[i2] = fgetc(PORT2);
i2++;
} |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Thu Jan 29, 2004 4:25 pm |
|
|
You should look throught the readme file. It has some information not available in the manual. Support for dual streams is newer than the manual and noted in the readme file. |
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Thu Jan 29, 2004 4:35 pm |
|
|
That works .. thanks alot |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Thu Feb 05, 2004 1:07 pm |
|
|
Where is the readme file. I am havin gthe same problem.. Thanx, |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Thu Feb 05, 2004 1:16 pm |
|
|
Found it.. DUH!... TTY |
|
|
|