07-29-2011 03:42 PM
Hello and Happy Friday.
I'm reworking a instrument driver for a HP 662X power supplies. We have four in the lab and I want to have a panel that writes the channel information and reads back what the instrument's setting are. I have the inputs working fine but I'm having trouble extracting the data from the "Read voltage and current" VI. What I would like is the reverse of "Build Array subVI where I can input an array and as the elements come in they are channel to the next available row. I have attached the program for review which should give you a better understanding of what I'm trying to accomplish here. Any ideas will be greatly appreciated. The driver I started with is the one downloaded from NI!
Thanks
Gary
Solved! Go to Solution.
07-29-2011 03:53 PM
07-29-2011 04:18 PM - edited 07-29-2011 04:18 PM
If your output is a 1-d array of #clusters, then you got a problem. If it is in just #clusters form, use unbundle block.
If it is a dynamic data, then use "From DDT" in Express-Signal Manipulation
If it is in waveform, you can handle it easily.
I can be wrong, i cannot open your vi, i dont'know why.
07-29-2011 04:44 PM - edited 07-29-2011 04:47 PM
Nix the Initialize Array stuff. That's not going to do what you want. Simply take the output(s) of the "Read Output Voltage Current" VI out through the loop. Autoindexing will give you arrays. Then simply use Index Array as shown in the second reply to get the individual values to wire to your separate terminals.
Also, your voltage and current controls need to be inside the event case. Otherwise the event case will only see the initial values, and if a user changed them, the new values will not be used.
Tip: An alternative is to place the 4 voltage controls into a cluster. Then you can simply use Cluster to Array and Array to Cluster with less wiring.
07-29-2011 04:50 PM - edited 07-29-2011 04:51 PM
I took a quick look at your code but I didn't download the driver and I don't have that instrument. My comment would be to let the for loop create the array for you. Each time that for loop iterates you get one voltage and one current measurement from the address defined by the iteration terminal +1. Just take those 2 measurements and wire them to a auto indexed tunnel on the right side of your for loop. This will create the array and you can index out the values or array to cluster and unbundle as you wish. Also note that there is increment primitive on the numeric pallette instead of using the + primitive.
Too slow. Like he said ^. lol
07-29-2011 04:50 PM
Also: why the property node for the VISA resource? Use a wire.
Attached is a slight mod showing the use of a cluster instead of individual controls, if you want to try that.
08-01-2011 12:12 PM
Thank you for you reply and the solution to my problem. I now have this driver running as either a stand alone or incorperated into a auto test system.
08-01-2011 12:20 PM
Peter,
Thank you for your input on extracting array data. I have this problem when working with arrays and although your solution look like it will work I was having trouble getting the indexing to work with the index array but I'm going to continue with your suggestion so I can get a better understanding of how that index array is controlled for future use.
Thanks Again
Gary
08-01-2011 12:28 PM
The alternate solution I suggested with the clusters was not intended to be a general solution for extracting array data. It was meant to simply the wiring so you didn't need to use Build Array to create your array from the individual 4 controls and then Index Array to get the array values written to the individual 4 indicators. Index Array is generally used for getting at array elements (or rows/columns). In your original code you didn't even need to use Index Array since a for-loop's auto-indexing capabilities was all you needed.
08-03-2011 10:22 AM
smercurio_fc,
I have implemented the cluster arrangement you had suggested for the writing of the output data to the channel indicators. There is a issue with writing the outputs. The output data isn't getting to the proper indicators with all channels being shifted down one location and channel 4 being written to the first location. Since I can't see what is going on inside the cluster I'm not sure why this isn't writing to the correct locations. Could you please take a look at the setup and see if there is anything that I'm doing to keep this from working.