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

Why there is some data duplicated during rs232 communication

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

Why there is some data duplicated during rs232 communication
PostPosted: Wed Dec 01, 2004 4:01 pm     Reply with quote

My Rs232 communicated well, but with a problem, that is sometimes, it output more result than I expect, like

printf("%u \r\n",data);

the hyperterminal print out \0A 234 \0D
occasionally print out \0A 234 234 \0D, or \0A 234 4\0D.

what might cause this problem?
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 4:11 pm     Reply with quote

I put a delay after printf; it looks everything is fine. maybe I am seding data too fast?

IN low baud rate, I need a long delay, in high baud rate, may not need delay, it depends.
Haplo



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

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 4:21 pm     Reply with quote

Is your printf() in a loop? Post more of your code.
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 4:26 pm     Reply with quote

Thank you: here is the main ()

Code:

main()
{
   while(1)
   {
   set_adc_channel( 0 );
   delay_us(50);
   temperature = Read_ADC();
   delay_ms(50);
   printf("%u \r\n",temperature,);
   }
}


by the way, another question, how to printf int32
for int8 a;
int 16 b;
is

printf("%u %lu", a,b);
Haplo



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

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 4:47 pm     Reply with quote

Well I'd say you were pumping out data so fast the the PC was missing characters. That made it look like duplicated data. A delay should take care of it as you said.

For int32 also use %lu.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 01, 2004 7:01 pm     Reply with quote

This isn't the first post where you have had problems with receiving chars to your PC. I'd look at the connections, MAX232 chip, cable, or even try another PC. And don't use Hyperterminal, in sucks!
MGP



Joined: 11 Sep 2003
Posts: 57

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 7:25 pm     Reply with quote

Mark wrote:
And don't use Hyperterminal, in sucks!


That's funny! It's the third time today I've either said that exact phrase to someone or seen it written by someone else.

Much better free terminal programs are TeraTerm Pro or Bray++ Terminal.

http://hp.vector.co.jp/authors/VA002416/teraterm.html

http://bray.velenje.cx/avr/terminal/
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 01, 2004 9:59 pm     Reply with quote

I just cannot believe that Windows still includes it!
CharlieGill



Joined: 29 Nov 2004
Posts: 15
Location: northeast georgia

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 02, 2004 6:09 am     Reply with quote

Thanks for the tips on a Hyperterminal replacement. I've never liked it but have just been to lazy I guess to go looking for a replacement.

I downloaded Bray Terminal as TeraTerm had it's last update in 99. I grinned when I saw the VT100 support. I wonder how many people these days even know what a VT100 was...ah the good old days. Well I guess they probably wern't all THAT good, 4K, asembler, cassettes, TV monitors, yuk. Still I miss the light and switches of the old control panels sometimes.

Charlie
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