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

Changing baud rate on the fly

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



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Changing baud rate on the fly
PostPosted: Thu Feb 26, 2004 6:04 am     Reply with quote

Hi
Can I use the set_baud_rate() to change the baud rate of a software serial port? Or does it only work with the hardware UART?
The manual says it is only for the hardware UART. In an application I have a software and a hardware UART with different stream identifiers, using the set_baud_rate() function with each of the indentifiers results in a different code (as in the .LST file), but it seems the software port doesn't change the speed.

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 26, 2004 12:33 pm     Reply with quote

Quote:
Can I use the set_baud_rate() to change the baud rate of a software serial port ?

No.
The CCS library code for software USARTs doesn't have the ability
to change the baud rate. The baud rate is determined by inline code
with software delay loops or just NOPs, to create the appropriate
pulse widths. These delays are hard coded at compile time.

The solution is to use a separate #use rs232 statement for each
baudrate that you need for your software USART. This will cause
the compiler to generate a separate set of ASM code for each
baudrate. Here is a post that shows one way to do this:
http://www.pic-c.com/forum/old/messages/3188.html
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