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

Two Baud Rates

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







Two Baud Rates
PostPosted: Fri Jun 25, 2004 8:14 am     Reply with quote

I am tring to use two baud rates but it is not working.

here is my code


stuff...

#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7)

stiff...

void Set_4800_Baud(); //sets GPS baud rate to 4800

stuff...

main() {

stuff...

#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7)
usb_wait_for_enumeration();
printf("\r\n\r\n***Enumerated2***\r\n");

stuff...

} // end of main()

#use rs232(baud=49600, xmit=PIN_C6, rcv=PIN_C7)
Set_4800_Baud()
{
signed int8 i;

for (i=0; i<BAUDSTRING_SIZE; i++)
{
putc(BaudString[i]);
delay_ms(2);
}
return;
}


but it does not work. The "stuff..." contains no RS232 code. The line
printf("\r\n\r\n***Enumerated2***\r\n");
should come out as 4800 but it comes out as 9600
Steve H
Guest







PostPosted: Fri Jun 25, 2004 8:26 am     Reply with quote

For problems like this I usually llok at the list file and follow the program execution. Usually I will find that the program flow isn't exactly like I thought it would be and one of the Use RS232's is not in the same logical sequence as I thought it would be.

Learning to look at the list file is a useful tool to debugging program problems.

HTH - Steve H.
Laurent Chouinard



Joined: 12 Sep 2003
Posts: 43

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 11:15 am     Reply with quote

try this, at the beginning of your program:

#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7)

then when you want to switch over to 9600, do this:

set_uart_speed(9600);

and when you want to go back to 4800:

set_uart_speed(4800)

This works only with the hardware serial power, which you are using right now (pins C6 and C7)
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