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

How to send long value over USART??

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



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

How to send long value over USART??
PostPosted: Thu Jan 31, 2008 1:57 pm     Reply with quote

HI
I'm working a project need to send long value numbers serialy.

Does any one now how can i sent long value over Usart ??
Let's say i whant to sent a number 1234.12 how can i do this?

putc() , fputc() send only character ,So how do i sent Long Value??
_________________
---- GREECE ----
E_KARVELAs



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

PostPosted: Thu Jan 31, 2008 2:07 pm     Reply with quote

Need to send From PIC micro to PIC micro.
Not PIC TO PC.
thanks
_________________
---- GREECE ----
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Jan 31, 2008 3:35 pm     Reply with quote

If you just want to send a 16 bit long you can use make8() and make16() to break the long into bytes. A number like 1234.12 is a float which requires make32() to reconstruct.
Or you can use printf() and maybe gets() to send the number as a string.
_________________
The search for better is endless. Instead simply find very good and get the job done.
E_KARVELAs



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

PostPosted: Fri Feb 01, 2008 7:44 pm     Reply with quote

SherpaDoug wrote:
If you just want to send a 16 bit long you can use make8() and make16() to break the long into bytes. A number like 1234.12 is a float which requires make32() to reconstruct.
Or you can use printf() and maybe gets() to send the number as a string.


HI
I found this in the compiler :
Code:

main() {

   char string[20];

   float f;

   f=12.345;

   sprintf(string," \f % 6.3 f ", f );
//in this case string[20] contein the float but coverted into char

}



Question!!!
getc() or fgetc()return a character.
What does the fgets() return from usart ???
didn't figure it out .
thanks
_________________
---- GREECE ----
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