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

Software UART setup_uart_speed

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



Joined: 18 May 2010
Posts: 2

View user's profile Send private message

Software UART setup_uart_speed
PostPosted: Tue May 18, 2010 7:16 am     Reply with quote

Hello,
I use a hardware and software RS232 on my PIC18F2480.
I want to change the Baudrate during program execution.
For the hardware I take the function setup_uart_speed(),
but this don't work with software UART.
How can I realize this with a software UART?

Regards
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 18, 2010 12:12 pm     Reply with quote

The baud rate for the software UART is hard-coded at compile-time.
It's not configurable at runtime.

Therefore, to use two different baud rates, you need to create two
#use rs232() statements, and define a Stream name for each statement.

Then in your program, use fgetc(), fputc(), fprintf(), etc., and put in the
stream that you want to use. The stream cannot be a variable. It must
be a constant. So you will need to use an if() statement to decide which
fputc() statement to call. Each fputc() statement will have a different stream.
Max1988



Joined: 18 May 2010
Posts: 2

View user's profile Send private message

PostPosted: Tue May 18, 2010 1:17 pm     Reply with quote

Thank you very much.
It works perfectly!!!!

Regards
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