View previous topic :: View next topic |
Author |
Message |
mindstorm88
Joined: 06 Dec 2006 Posts: 102 Location: Montreal , Canada
|
Data logging via rs-232 |
Posted: Mon Apr 26, 2010 8:43 pm |
|
|
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
|
|
Posted: Tue Apr 27, 2010 5:13 am |
|
|
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
|
|
Posted: Tue Apr 27, 2010 6:46 am |
|
|
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
|
|
Posted: Fri Apr 30, 2010 11:18 am |
|
|
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
|
|
Posted: Fri Apr 30, 2010 11:48 am |
|
|
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. |
|
|
|