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

#use RS232 switching baud rate during execution

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



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

#use RS232 switching baud rate during execution
PostPosted: Sat May 08, 2004 7:19 pm     Reply with quote

Hi I'm using PCM Version 3.168 with PIC 16F876, doing serial comms with hardware USART.

Is it possible to change baud rates mid program? At the start of the program I set baud rate to 19,200 however I'm wondering if I can switch to 9,600 to send out a few bytes, and them immediatly switch back to 19,200?

Thanks
pat



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

PostPosted: Sat May 08, 2004 7:23 pm     Reply with quote

PS One more thing, it compiles ok, but when I run it, it still transmits at 19,200 bps.

Here is the code snippet

Code:

if (!datalogging) {
   /* Output max value in binary LS Byte then MS Byte at 9,600 bps */
   #use rs232(baud=9600, bits=8, parity=N, ERRORS, xmit=PIN_C6, rcv=PIN_C7)
   putc (make8 (y_max, 0));
   putc (make8 (y_max, 1));
   #use rs232(baud=19200, bits=8, parity=N, ERRORS, xmit=PIN_C6, rcv=PIN_C7)
}
Haplo



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

View user's profile Send private message

PostPosted: Sat May 08, 2004 8:18 pm     Reply with quote

If you are using the hardware UART, you can use the set_uart_speed() function to change the speed on the fly.
pat



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

PostPosted: Sat May 08, 2004 8:29 pm     Reply with quote

Wow so simple, thanks. I never noticed that function in the manual.

Thanks again
Haplo



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

View user's profile Send private message

PostPosted: Sat May 08, 2004 9:35 pm     Reply with quote

Actually that function is not in the official manual, but you can find it in the Readme.txt file in the compiler directory. This files contains information about all the neat functions that have been added since the last manual release.
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