09-25-2018 01:17 PM - edited 09-25-2018 01:18 PM
I have to use LabView to get data from two GPIBs. Basically I'm setting the voltage through the program, and getting the input from a picoammeter at that voltage. I have it showing the voltage, current, and loop count, and those show up fine. But it never leaves the loop properly. My file at the end will be full of zeros. I have looked at examples here, and tried some of the fixes. But I couldn't get them to work. This is my first experience with LabView...
09-25-2018 01:28 PM
There are some odd constructs in your code.
In 05_01.vi, you have an insert into array, but the index is based on the loop iteration counter divided by an increment, and that is by default 0 on your control. It is odd to base an index on a calculation, and certainly one that has a floating point result.
_Concat.vi is better, but it is still odd to use the i value and Insert Into Array. You are effectively just appending to the end of the array, so it is much more common and proper to use Build Array. I estimate 99% of the time I would use Build Array, and 1% or less of the time to I need Insert into Array.
It's hard to tell from your description and the rest of your code what you are trying to do. Are you sure those GPIB functions are always returning values and not erroring out and returning zeroes? Those GPIB functions are pretty archaic. It is more common to use VISA functions even for communicating to a device via GPIB.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
09-25-2018 02:21 PM
Is your goal just to create an array with one piece of data from each time the loop runs? If so, you can just use an auto-indexing output tunnel and LabVIEW basically does it for you - like this:
If your goal is something more complex, can you explain more so we can try to help?
09-25-2018 04:00 PM
I know it is getting data from the GBIP properly, because I have it reading it out as well and those read fine. And it also sets the Voltage up the way I set it. Also my professor set that part up for me.
Basically what my project is supposed to do is first set the voltage. It then increments the voltage up in increments I set, up to 30 volts. Each iteration it should add two values to an array, one voltage and the current at that voltage. After the loop is done it should export the voltage and current to an excel file that I can plot voltage vs current.
So I set the tunnel to auto indexing?
09-25-2018 04:01 PM
Thank you for the tutorials also. I'm a transfer student and everyone else in the class has used LabView for a few years, and this is my first experience with it.
09-25-2018 04:06 PM
Yeah, if that's your use case, you really don't need to do anything tricky with inserting into an array. Wherever you have your voltage (should be a scalar, not array, value), just wire from there into your loop so it makes a tunnel and set it to auto-indexing. Do the same for your current value. Then, outside the loop, you will have two arrays made up of all your voltage values in one array and all your current values in the other array. You can then format these however you like to write to file.
09-25-2018 04:10 PM
Look at the ramp function. It will generate an array of the voltage values. Feed that into a For Loop using an autoindexing tunnel. Thing of an Autoindex input tunnel as "For Each element In array". Take the current measurement and output that through an auto-indexing tunnel. Now you'll have an array of currents as well.