Olivier,

> I am writing a data acquisition and display program, so I 
> need to "send" 
> several floats from the RTLinux thread (where the data is 
> acquired) to the 
> linux/Qt program for display. There will probably be up to 16 
> floats being 
> sent at a rate of probably 200Hz, possibly up to 1000Hz.

        You will have absolutely no problems with these data rates on a
reasonably quick machine (almost any machine, for that matter).

> rtf-put only accepts characters, so it desn't seem to be ideal.

        For something quick and dirty, you could do something like:

        for (index=0;index<num_params_to_send;index++) {
                rtf_put(MY_DATA_FIFO, (char *)&my_data[index],
sizeof(mydata[index]));
        }

        If you wanted to do something so that you had only one FIFO write
(and thus nearly assuring that your data will arrive at the non-RT end
atomically {though you probably assure that with priorities}), you could use
memcpy or some such to copy the data from the various floats or doubles or
longs or whatever into one structured buffer.  Then disassemble it at the
other end.

        It is a bit dangerous (and bad practice) to simply fill C structs
and transfer them.  This assumes that the structure packing will be the same
at both ends, which may not be the case.  Explicitly filling the buffer
yourself is the safest move.

        On another note, I am not sure why rtf_put is typed to take a (char
*).  It seems to me that a (void *) would be more appropriate, since it
should not care what type of pointer it gets.

> mbuff looks interesting but I have found the doc to be sparse.

        There is nothing you can do with mbuff that you can not do with
FIFOs, unless you get into very high bandwidth applications.  You are
nowhere near that point.  Thus I would recommend using the FIFOs for
structure.

> I am sure that many of you have had to do this, so I would 
> like to hear your 
> opinions. Code snippets would be appreciated to help me along.

        You've got em.

Regards,

Steve Cohen

--------------------------
Stephen D. Cohen
Xybion Sensor Positioning Systems
11528 53rd Street North
Clearwater, FL 33760
Voice: (727) 299-0150
Fax: (727) 299-0804 
[EMAIL PROTECTED]
www.xybion.com

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to