03-27-2017 10:39 PM
I'm modifying the Continuous Measurement and Logging sample project to work with a new device.
During the hardware setup, one of the driver functions sets up an array in memory where the samples will be stored (this is done once, at the beginning). The acquisition loop calls a get_streaming_values functions, that asks the board for the new values so that the array now stores the acquired samples.
The problem is that I have to pass the array from the configuration subvi to the acquisition one in such a way that I can get updated values during every iteration of the acquisition loop.
I cannot directly add the array as a new element into the Hardware Resources cluster because this way I would copy the value of the array just after the hardware setup (which initializes it to all zeroes) so I was thinking about some C-like pointer reference/dereference operations.
Is there any better/suggested way?
03-28-2017 06:50 AM
As long as the Configuration VI is the only place updating the array, I would just use a Global Variable.
03-28-2017 07:18 AM
Is the driver a DLL? Does it accept a memory buffer as a parameter that it stores, initializes and writes to? If you want to share a memory buffer with a DLL, it's probably best to do this in C and write some interface code for Labview. In my experience, you don't want the driver writing to memory managed by Labview. Also, I'm not sure there is a way to ensure the same buffer is used everywhere without copying. The Data Value Reference does this, but I'm not sure it wouldn't pass a copy into a DLL. I'd have to check.
04-01-2017 03:18 AM - edited 04-01-2017 03:19 AM
crossrulz ha scritto:
As long as the Configuration VI is the only place updating the array, I would just use a Global Variable.
I suppose it is not the case, in fact by using a global variable, even in the same VI (just cut the wire and use the variable on both ends) only shows the original values written during the initialization and no actual samples.
04-01-2017 03:36 AM
I think it's better to show you in practice what I want to achieve.
The starting code comes from here. I want to integrate the PicoScope2000aExampleStreaming.vi into the Continuous Acquisition.
The problem is how to split the Channel A wire coming from the StartStreaming block, and entering the acquisition loop.