From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure help

HI,

       I am working with jki state machine. I have problem with my case structure. I have two case structures, one inside other and a while loop at outside with inside case structures. I written some code in case structure(first state of the state machine) which outputs as true or false are connected to another case structure selector terminal. If the code returns false first time I would like switch it to another state. If the code(first state of the state machine() returns false second or 3rd time or more(or after some true outputs), I would like to switch another state. Can some one suggest me some idea. I spend lot of time on this and could not able to figure out.

0 Kudos
Message 1 of 23
(6,029 Views)

Keep another boolean state in a shift register or feedback node. Initialize as TRUE and switch it once the "first time" has happened. Use boolean operations ("First time" AND "boolean state") to switch only if both are true.

 

If is typically much easier for us to help if you attach some code. It is much easier to understand than long descriptions... 😉

Message 2 of 23
(6,026 Views)

I am learning labview at the moment and I don't understand your suggestion quite well. I just want do something when I read false first time to case terminal(if I read true many times and then false then I want to some other thing only in that false case).

0 Kudos
Message 3 of 23
(6,016 Views)

Is this a joke? Why would you typecast a boolean array to a boolean?????

 

Attach your VI, not code pictures

0 Kudos
Message 4 of 23
(6,012 Views)

I am getting boolean array which i want to connect to case terminal of different type. So, that is the only reason i converted that 1D array to scalar value by typecast. Please let me know, if there are more mistakes. As i told before about first time false condition. You can see that in Read RAM state, there, i need to switch another state if i read false first time(Thats means when DAQ read state run only first time) and if this states run more than one time and if it returns false i want to switch to another state. I am not going to attch sub vi's here.

0 Kudos
Message 5 of 23
(6,002 Views)

I think I understand your question but I am not too sure what you want to accomplish. Depending on what your goal is you might be able to use the "First Call" function in LabVIEW. It can be found under synchronization.

=====================
LabVIEW 2012


0 Kudos
Message 6 of 23
(5,989 Views)

Hello,

               Can I use that "first call" option in a case structure of having many cases. So that, I can use return true value of "firstcall" option when a case of case structure runs for the first time after i start the run VI button.

0 Kudos
Message 7 of 23
(5,986 Views)
0 Kudos
Message 8 of 23
(5,984 Views)

I thought that I can use that firstcall option but I have a situation that, I need to switch to two different states in false case of that inside case structure of DAQ read state. If inside case structure terminal encounters false when "DAQ read state" runs first time, I want to switch to "fixed state" but if inside case terminal hits true first time and false second time(in this situation of false case, I would like to switch to eeprom write state). please suggest any other way.

0 Kudos
Message 9 of 23
(5,977 Views)

Then you'll need to use a shift register or feedback node as Altenbach suggested in the earlier reply to store the information from iteration to iteration as to what the next case might possibly need to be.

0 Kudos
Message 10 of 23
(5,973 Views)