LJM_eWriteNameArray and STREAM_OUT0_BUFFER_U16 | LabJack
 

LJM_eWriteNameArray and STREAM_OUT0_BUFFER_U16

6 posts / 0 new
Last post
eric11
eric11's picture
LJM_eWriteNameArray and STREAM_OUT0_BUFFER_U16

I have a question regarding writing to the STREAM_OUT0_BUFFER_U16 modbus register with the LJM_eWriteNameArray  routine.

The syntax for LJM_eWriteNameArray  is:

Syntax LJM_ERROR_RETURN LJM_eWriteNameArray( int Handle, const char * Name, int NumValues, double * aValues, int * ErrorAddress)

The "aValues" datatype is double.

If the Name is set to be "STREAM_OUT0_BUFFER_U16", does an array of type "double" need to be passed in?  

Don't you want to pass in an array of type Integer (VB6)?

What is the size of the data being sent down to the device?   NumValues*16? or NumValues*32?

Is an Integer array being sent down or a double array?

 

Thanks,

Eric

 

 

 

 

LabJack Support
labjack support's picture
LJM's C API takes doubles for

LJM's C API takes doubles for aValues, so you can use the double type. This is fine since double precision floating point numbers encompass the range of possible 16-bit (and 32-bit) integers. The double will get converted into an 16-bit int by LJM before being sent to the device. Each int16 value should be represented by one double value in aValues. (Though the actual data payload is of size NumValues*16.)

eric11
eric11's picture
Would it be possible to

Would it be possible to propose a feature request that integer values be transferred over ethernet/usb (vs double) when writing to the STREAM_OUT0_BUFFER_U16 register?  That would halve the data needed to transfer. 

I'm having trouble maintaining continuous output streaming data, when also streaming input data when the data rate gets above 20Khz.  

Thanks,

Eric

 

 

LabJack Support
labjack support's picture
That's already how it is. If

That's already how it is. If you're writing to STREAM_OUT0_BUFFER_U16, LJM converts the doubles into u16s and sends those over the wire.

You could try connecting your T7 directly to your computer via Ethernet, if you haven't tried that already:

https://labjack.com/support/faq/how-do-i-connect-t7-directly-my-computer...

That oftentimes has the best streaming throughput.

eric11
eric11's picture
Do I understand this

Do I understand this correctly? 

Although I'm calling LJM_eWriteNameArray, and passing in an array of doubles, LJM_eWriteNameArray converts them to 16 bit, before they are transferred down to the device?

Thanks,

Eric

 

 

 

 

LabJack Support
labjack support's picture
That is correct. You can use

That is correct. You can use the LJM debug log to see the actual bytes being sent to the device if you'd like.