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

Data logging via rs-232

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



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

Data logging via rs-232
PostPosted: Mon Apr 26, 2010 8:43 pm     Reply with quote

Hi guys, I need to log 4 (int16) every 500ms, is printf fast enough ?? Will it slow down all other process ?? Should I use putc instead ??

Thanks
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 27, 2010 5:13 am     Reply with quote

Sure it can however..

Your data could be sent as 8 bytes.
Time depends on serial interface speed (110 baud ...115200 baud...?)
also how you 'create' your data (from rom,eeprom,a2d,calculations).

I suggest you doing this one step at a time,once you get it working, look over the listing and see where you can shave off time(if required), either by tighter C code or using assembler.
SherpaDoug



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

View user's profile Send private message

PostPosted: Tue Apr 27, 2010 6:46 am     Reply with quote

16 bytes per second is pretty slow. The overhead of printf() should not be a problem.
_________________
The search for better is endless. Instead simply find very good and get the job done.
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

PostPosted: Fri Apr 30, 2010 11:18 am     Reply with quote

SherpaDoug wrote:
16 bytes per second is pretty slow. The overhead of printf() should not be a problem.


You're right , finally i do transfer 4 int32 every 500 ms at 19200 bauds over 50 feet without affecting others processes

thanks
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Apr 30, 2010 11:48 am     Reply with quote

You don't need it but supposing printf was too slow at moments but on average OK. Say you have a few hundred lines of code then a long printf.
#INT TBA can be used with a transmit circular buffer. CCS has the printf to a function that is not hostage to the baud rate. The function drops the char into the buffer and the transmit isr chews on them sending them out while your main program slogs through your several hundred lines of code. A silly example. The baud rate is 110 and your printf is 100 chars.. 10 secs to execute the printf statement is not so good. The printf to a function does the printf at PIC speed to the buffer. Now over the next ten sec the isr chews away at the buffer but allows your main code to get on with things.
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