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

question about USART change its baud rate during the process

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



Joined: 03 Dec 2008
Posts: 45

View user's profile Send private message

question about USART change its baud rate during the process
PostPosted: Thu Jan 14, 2010 12:20 pm     Reply with quote

How can I change baud rate after I received data and change back again after send out and so on ? For example the USART set to #use rs232(baud=9600, xmit=pin_c6,rcv=pin_c7) and I used interrupt to receive data. After I got enough data I want to send out data but need different baud rate for example #use rs232(baud=4800, xmit=pin_c6,rcv=pin_c7) what should I do. Do I need disable interrupts and after initial enable it again?

I am appreciate for any concern...
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Thu Jan 14, 2010 12:52 pm     Reply with quote

I change the Usart register values on the fly.

Check the USART registers, mainly SPBRG...
This is for a 877 running at 20 Mhz if I remember correctly.
PBP Code....

SELECT Case Tmp
Case 0 '57,600 SEE NOTE ON & ON
SPBRG = 21

CASE 1 '38400 ON & OFF
SPBRG = 32

CASE 2 '19,200 OFF & ON
SPBRG = 64

Case 3 '9600 OFF & OFF
SPBRG = 129

End;
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 14, 2010 1:19 pm     Reply with quote

Download the CCS manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look in this section. It has a list of CCS functions that handle RS-232:
Quote:

BUILT-IN-FUNCTIONS

RS-232

There are one or two CCS functions that let you change the baud rate of
the hardware UART. You don't have to write directly to the SPBRG
register. It's easier to use the functions.
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