08-17-2020 01:57 PM
Hello,
Please check out the attached VI. I've inherited code from a previous engineer and I'm trying to wrap my head around how this particular VI works. I appreciate it!
Jay
Solved! Go to Solution.
08-17-2020 07:39 PM
You did not attach your typedefs, but you have a cluster of two enums, each with four choices. Two bits are sufficient to describe four states, so you create an output array with four bits to fully describe the state of the two enums.
You can look at the help for any of the primitives. Let us know if anything is not clear..
08-18-2020 07:12 AM - edited 08-18-2020 07:13 AM
Without the VIT Config cluster i can't tell you exactly what it does, but assuming that Voltage is in volts and Current is in amperes then what you are doing here is you convert an 8 bit number to boolean array, negate it and then take the first two values of boolean array.
So it basically ignores values less than 64 (so 64V or 64A) and then writes two most significant digits negated to DAQ.
EDIT: It'd also help to know what this controls, because right now i can't really imagine what you would control like this.
08-18-2020 08:44 AM
Hello,
Thanks for the replies! I've attached the .ctl files that go with this.
So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.
I'm not sure what the best approach to this would be. Maybe tie the enums into a case structure? Although I believe the VIT may need the binary settings to be written to it all at once.
Any suggestions would be appreciated!
Jay
08-18-2020 09:27 AM - edited 08-18-2020 09:28 AM
@JayWW wrote:
So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.
What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges. You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.
08-18-2020 09:41 AM
@crossrulz wrote:
@JayWW wrote:
So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.
What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges. You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.
How would I interface this with the needed binary output to properly communicate what range to set the VIT?
Thanks,
Jay
08-18-2020 09:58 AM - edited 08-18-2020 09:58 AM
@JayWW wrote:How would I interface this with the needed binary output to properly communicate what range to set the VIT?
Instead of indexing the original array, index another lookup table.
08-18-2020 11:17 AM - edited 08-18-2020 11:19 AM
@crossrulz wrote:
@JayWW wrote:How would I interface this with the needed binary output to properly communicate what range to set the VIT?
Instead of indexing the original array, index another lookup table.
What kind of array is the circled icon? It doesn't look familiar.
Thanks,
Jay
08-18-2020 11:27 AM
08-18-2020 11:41 AM
@JayWW wrote:
What kind of array is the circled icon? It doesn't look familiar.
"index array". It looks different because the input is a 2D array, requiring two inputs for the index. The primitive automatically adapts to the wired input.