Simple question about UsbPt104GetValue

Post general discussions on using our drivers to write your own software here
Post Reply
iain_w
Newbie
Posts: 0
Joined: Mon Feb 22, 2016 2:43 am

Simple question about UsbPt104GetValue

Post by iain_w »

I am using the PT-104 data logger and writing some software to control it. The API provides a UsbPt104GetValue function - prototype:

Code: Select all

PICO_STATUS UsbPt104GetValue (
short handle,
USBPT104_CHANNELS channel,
long * value,
short filtered
)
The long * value argument receives the data. I see that it is a pointer - how large is the returned data? Is it guaranteed to just be a single long-size item, or is the pointer indicating that an array of items can be returned here? If so, how can the programmer tell how much space to allocate for the data?

That's it, really. I'm assuming that just a single long-size item is returned, but assuming things is how bugs tend to work their way into my code! If anyone can let me know for sure, that would be great.

Thanks,

Iain

Hitesh

Re: Simple question about UsbPt104GetValue

Post by Hitesh »

Hi Iain,

The value parameter will consist of a single signed 32-bit integer returned from the driver so the argument can either be a variable consisting of a single value or an array.

If it is an array, the value will be written at the position specified e.g. if you have an array called values consisting of 10 elements and pass values[5] to the call it should write the value to the 6th element in the array.

Hope this helps.

Post Reply