11-02-2020 04:18 PM
I have a DAQ I/O that I am using a sequence loop to control. I want to make it so that the second DAQ box is initiated when the boolean [10] (converted to number 1) is measured. I would then like it to return to the first box in the sequence when [01] (numerical 2) is measured. I'd like this loop to occur indefinitely until the stop command is initiated. Any help is appreciated.
11-02-2020 04:43 PM
Okay, so you have a bit of unnecessary in your code. Let's first start with some questions and you can better explain what's happening.
1) Does your code work at all on your end?
2) How many physical DAQ boxes are there?
3) Are you inputting the pressure values?
4) How many total physical relays?
11-02-2020 05:45 PM
1) Does your code work at all on your end?
I've gotten it to work fine if I have a single case structure. I am trying to add a second one, because during increasing and decreasing pressure intervals, the sensor will be reading the same pressure output, but I will need the opposite I/O state.
2) How many physical DAQ boxes are there?
There are 3 states and 2 DAQ I/O ports.
State 1
Relay 1 On, Relay 2 off
State 2
Relay 1 Off, relay 2 on
Boolean to numerical outputs will give me:
In first case structure
0 - State 1
1 - State 2
2- State 1
Second case structure
0 - State 2
1 - State 2
2 - State 1
3) Are you inputting the pressure values?
The current pressure input value is just a placeholder, I will be replacing it with an SPI sensor readout.
4) How many total physical relays?
2
11-03-2020 04:23 AM - edited 11-03-2020 04:34 AM
@jd555 wrote:
I'd like this loop to occur indefinitely until the stop command is initiated. Any help is appreciated.
Simplify it into a simple state machine. One loop. One case structure, one state variable in a shift register.
11-05-2020 02:19 PM
I haven't figured out how to reduce this to a single case structure, because my issue is that I need a 0 value to result in a different state as a result of the same pressure measurement. I am making a pressure chamber to create a pressure waveform, so if (for instance) I measure 1 PSI, I will need this to be either state 1 or 2 depending if I am in the ascending or descending slope of my waveform. How would you recommend accomplishing this with a single case? I'm sure I could create a boolean function that could give me 4 possible integers readouts, but I have minimal experience am completely new to logic and controls.
11-06-2020 05:42 AM
You could just use a feedback node and compare the current and previous pressure to see which direction it is currently going and react accordingly.