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

Printf on UART2

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



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

Printf on UART2
PostPosted: Thu Jan 29, 2004 2:57 pm     Reply with quote

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 Sad
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 Smile

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: 1933
Location: Norman, OK

View user's profile Send private message

Using Two UARTS
PostPosted: Thu Jan 29, 2004 3:19 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 29, 2004 4:25 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 29, 2004 4:35 pm     Reply with quote

Very Happy

That works .. thanks alot Smile
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Thu Feb 05, 2004 1:07 pm     Reply with quote

Where is the readme file. I am havin gthe same problem.. Thanx,
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Thu Feb 05, 2004 1:16 pm     Reply with quote

Found it.. DUH!... TTY
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