06-25-2025 01:32 PM - edited 06-25-2025 01:33 PM
@andrew_h01 wrote:
Note that all three case structures run in parallel and at the same time, and some try to access the same resources at the same time. This is highly flawed!
06-25-2025 01:41 PM
Hey Christian, thanks for your help so far. I am in the process of cleaning up my code for it to be better understood and debugged.
I checked the logic of your program you sent and it makes sense. However; what's unclear to me is the connection between the True/False Boolean LED on the end inside the while loop and how that can be connected to parallel case structures to determine if the solenoids should be on or off.
A couple of common errors is:
1. When running this program when I was using the DAQ Assistants the resource tasks were being used simultaneously therefore I switched to using DAQmx code and ending and clearing the tasks but I think this is an issue as well because if I do that then the solenoids states only switch for a split second because they immediately will get turned back off, I believe, seems like I am at a crossroads where I potentially need to nest conditions with the other solenoids?
2. Case selectors not triggering the solenoids so probably stemming back to issue with what I asked above and attached images of which is the connection between True/False Boolean and how the case structures can be in parallel.
See images below.
06-25-2025 01:47 PM
On further thought, inside the while loop I probably don't need the case selectors and can just go straight from and/or logic to auto-start of the DAQmx write function.
06-25-2025 01:47 PM
They cannot run truly in parallel but the order is unknown and whatever goes first grabs the resource and the other will probably fail. Do you get any errors?
06-25-2025 01:51 PM
@andrew_h01 wrote:
On further thought, inside the while loop I probably don't need the case selectors and can just go straight from and/or logic to auto-start of the DAQmx write function.
You still need to create the channels only once before the loop (and close them after the loop) and just write the values.
I doubt you need the third case structure all all, because you can just determine the correct boolean output for each channel based on all three comparisons.
06-25-2025 02:46 PM
Attached is cleaned up program and edited. Tested the logic, and tested with hardware, and solenoids are still not firing, is there a way I can wire up an LED to light up as the Digital Outputs are being triggered if one solenoid is on vs. off?
06-25-2025 03:52 PM
@andrew_h01 wrote:
is there a way I can wire up an LED to light up as the Digital Outputs are being triggered if one solenoid is on vs. off?
You can right-click on any wire and create indicator. For a boolean wire you would get an LED.
LabVIEW also has "probes". Are you familiar with the debugging tools?
I am currently doing some "real work". Will look at your VI later.
06-25-2025 03:58 PM
You are still creating duplicate virtual channels and then write to them in parallel.
06-25-2025 04:07 PM - edited 06-25-2025 04:14 PM
So, assuming that you want an unconditional FALSE on both channels if the third comparison is true, but otherwise output the values from the upper two comparisons, here's a quick draft without all the trimming.
Note that you did not wire the booleans correctly at all. The output of the comparison does NOT belong to the optional autostart input on top. That's plain crazy!
I am sure if you setup the channels correctly, all you need is a single write where you wire an array of the two booleans.
06-25-2025 04:51 PM
@altenbach wrote:
They cannot run truly in parallel but the order is unknown and whatever goes first grabs the resource and the other will probably fail. Do you get any errors?
From the screen shots those look like software timed digital tasks. You can run multiple ones at a time. See this