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

Serial Input

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



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

Serial Input
PostPosted: Fri Aug 26, 2005 4:47 am     Reply with quote

Could somebody please solve a problem for me. I have read numerous posts on the forum and implemented (tried to) them with no sucess.

I have a PIC16F877 4MHz interfaced to a sensor which outputs serial data ( a string of ascii characters that can be read by a pc serial port)
I initiate a reading then want to read back the data.
It is being transmitted at B9600 (although this can be slowed to B1200)
I want the PIC to read the data and store it in avariable. The data is numbers 24 characters long (consisting of 4 seperate measurements).
Can anyone post code that works? or any ideas please.
Many Thanks
Steve
Ttelmah
Guest







PostPosted: Fri Aug 26, 2005 5:01 am     Reply with quote

How are the numbers seperated?. What marks the start/stop of the 'packet?. How are the nubers represented (integer, floating point etc.). Post an example of the string involved, and somebody may be able to help.

Best Wishes
Guest








PostPosted: Fri Aug 26, 2005 7:07 am     Reply with quote

Good Point. String example as follows.

+13.238, +24.855, +07.6382, +1504.6563

Could live without the sign and decimal points though, would be happy with raw numbers. ( I can do it in PBP but need CCS C code to work!)
Thanks in advance
Steve
Guest








PostPosted: Tue Aug 30, 2005 2:37 am     Reply with quote

Also using fget, fprint etc instead of get print, as i am using multiple software serial ports defined with seperate streams.
Thanks
Mark



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

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

PostPosted: Tue Aug 30, 2005 6:28 am     Reply with quote

Search the help file or manual for STRTOK() for your answer. If you need to convert each substring into a number take a look at atof() also.
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