06-10-2025 04:31 AM
I have a Labview VI that is not acting as it should and I'm hoping someone can point out my error, I'm sorry, I can't seem to see it.
I would like to assign a different value to 10 individual voltage rails. Each assigned voltage rail could be one of 11 different inputs.
1. It could be one of the 8 measured inputs
2. It could be a fixed voltage of 3.3V, 5V or 12V.
So, in the example below, I would like to assign Rail 0 to Rail 1, Rail 1 to 3.3V, Rail 2 to Rail 3 and so on
When I run the code, all the assigned rails seem to be determined by what every value I have in the last option. In this case, everything is assigned to what rail 9 is set to of 12V.
I'm assuming I am messing up the indexing.
VI attached.
Any pointers would be much appreciated thanks
Rod
Solved! Go to Solution.
06-10-2025 04:36 AM
Hi Rod,
@RodWatt208 wrote:
VI attached.
Any pointers would be much appreciated thanks
Please downconvert the VI before attaching (again) so more people can actually open the code.
Most prefer LV2021 or older, I prefer LV2019…
@RodWatt208 wrote:
When I run the code, all the assigned rails seem to be determined by what every value I have in the last option. …
I'm assuming I am messing up the indexing.
Sound like the problem is in your code… 😄
06-10-2025 04:52 AM
Older version attached
06-10-2025 05:51 AM - edited 06-10-2025 05:56 AM
Hi Rod,
@RodWatt208 wrote:
Older version attached
Thanks.
Your VI does EXACTLY what you have programmed to do!
(Apparently you want something different than what you programmed…)
The FOR loop executes for each "Rail Selector 2" item (or as many samples as there are in the waveforms).
The last loop iteration determines the content of those "Rail x - Assigned" indicators!
Try something like this instead:
Do you REALLY want to index those sample arrays at the FOR loop???
06-10-2025 07:20 AM - edited 06-10-2025 07:33 AM
This post edited due to Forum issue
Seriously Interesting. Double post! Haven't seen that in years.
06-10-2025 07:28 AM - edited 06-10-2025 08:07 AM
Interesting.
I doubt that your understanding of the Case structure is your worst problem! Let's look at the For Loop.
For Loops with Autoindexed inputs iterate exactly as many times as the number of elements in the LEAST populous autoindexed array. You actually CAN wire an indicator to the INSIDE of the For Loop "N" block to read that Number. <HINT: do that!>
@Gerd, I'd unbundle the y[]components out of the array of waveforms INSIDE the autoindexing For Loop......I think that that silly breakout before the loop will probably be a "Face-Palm" correction for the OP.
NOTE: the number of Waveforms is definitely contained within the DAQmx Task as intrgal to all measurements of interest. Explicitly indexing individual Waveform y arrays then looping over each y element is seldom RIGHT. I suspect one of the Waveforms indexed before the loop is empty ( default data with a 0 element y array leading to a 0 iteration For Loop - facepalmable)
Worse, the DAQmx Task could have DACMxScales applied for each Channel .... making all of the gyrations after acquisition moot.
06-10-2025 08:37 AM
Thank you GerdW, that worked as I intended.