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

How to use multiple UART (or EUSART)

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







How to use multiple UART (or EUSART)
PostPosted: Mon Apr 02, 2007 8:01 am     Reply with quote

I'm using the PIC18F2620, and I can use it with my code no problem with the standard receive and transmit pins (C6 and C7), but if I try to use it on two different pins (B5 and B6), it gives me an error on the line:

set_uart_speed(2400);

Is there something else I need to do when switching from the standard hardware UART pins to other pins?

Thanks!

Seidleroni
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Apr 02, 2007 9:07 am     Reply with quote

With the standard pins (C6 and C7) the compiler will select the internal hardware UART. When you select B5 and B6 the compiler will generate a software UART.

Check the manual, set_uart_speed() is only allowed for changing the baudrate of the _hardware_ UART, it is not allowed for a software based UART.


Last edited by ckielstra on Mon Apr 02, 2007 9:07 am; edited 1 time in total
Ttelmah
Guest







PostPosted: Mon Apr 02, 2007 9:07 am     Reply with quote

Read the manual entry for 'set_uart_speed'. Noth that it says:

"Changes the baud rate of the built-in hardware RS232 serial port at run-time".

Note the word 'hardware'...
You cannot change the speed of a 'soft' UART. The software UART, is done by generating specific code for the speed requested.
If you want two speeds on a software UART, then declare two 'streams' on the pins with different baud rates, and select the stream to get the required rate (this results in two separate routines being generated).

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