LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Momentary switches and sequential logic--- seeminly not available in Labview

Please can anyone help with this:

I want the "true" output from an error dialog box ( after hitting ok button on the dialog) to give me a momentary true output and then fall back to false.

Is this possible and how ? Your prompt responses will be appreciated !

[BADGE NAME]

0 Kudos
Message 1 of 39
(3,496 Views)

@blessedk wrote:
Please can anyone help with this:

I want the "true" output from an error dialog box ( after hitting ok button on the dialog) to give me a momentary true output and then fall back to false.

Is this possible and how ? Your prompt responses will be appreciated !

When you loop back around and there is no error, it should be FALSE.  I don't understand what you are trying to do.  Perhaps you should supply a better example, with a block diagram.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 39
(3,483 Views)
Basically I want to be able to apply a short "true " pulse to a while loop condition terminal and then return that to false after a second or so. I don't want to do this with a Boolean switch. I prefer the user clicks the OK button to generate a short-lived true pulse.

[BADGE NAME]

0 Kudos
Message 3 of 39
(3,463 Views)

I moved this message into a new thread.  While your question seemed related to the title of the thread you posted in, it was an 11 year old thread, a very long thread, and that thread quickly devolved when the original poster went into a series of trolling rants.

 

You are more likely to be helped with your message now posted in a new thread.

 

If crossulz's reply doesn't help you, then I suggest you post the VI that you are working on giving you trouble so that we can see exactly what you are trying to do.

0 Kudos
Message 4 of 39
(3,461 Views)

@blessedk wrote:
Basically I want to be able to apply a short "true " pulse to a while loop condition terminal and then return that to false after a second or so. I don't want to do this with a Boolean switch. I prefer the user clicks the OK button to generate a short-lived true pulse.

If the while loop conditional terminal changes, the loop will terminate and the boolean state is no longer relevant. How does the while lop start over?What else is there? Obviously, you are not telling us the whole story. Please attach your VI.

0 Kudos
Message 5 of 39
(3,441 Views)
Worthy Knight, I am probably the newest Labview self- learner exploring all I can do bear with me :). I now understand that what I was thinking about doing is practically impossible. Now here is what I am trying to do: Ultimately I want to implement some kind of state machine that allows me to repeat sections of code irrespective of their position on my block diagram. I started off this project without realizing that when a program runs through an earlier section of code, you can't go back and re-run that section without a state machine. Now I have a large vi ( which I probably should have broken up into subvis stage by stage as my diagram was growing. Now it is extremely difficult to generate subvis from this large diagram because of the way wirings and objects are laid out. Also I already have a front panel (which I am very happy with) madeout of the single large vi. I don't know if there is way I can implement some sort of state machine directly on the single large vi without breaking it to into subvis.

[BADGE NAME]

0 Kudos
Message 6 of 39
(3,376 Views)
You can easily achieve anything you want using LabVIEW. You simply need to understand and embrace data flow. A state machine is most often the right architecture.
It is difficult to give more detailed advice without seeing some actual code. Have a look at the design templates that ship with LabVIEW.
0 Kudos
Message 7 of 39
(3,366 Views)
The issue is not really with the code but achieving flexibility ( being able to go back to earlier sections of codes at random and run them. My block diagram works pretty good; the only issue is that once it runs past a particular code section of the block diagram, I can't get back to re-run it unless I stop and click the Labview run button and then it will have to start running the block diagram from the very beginning. I know I can achieve this using a state machine but right now it is difficult to break down my block diagram into subvis. I am looking for a way to be able to re-run any section of my code at random but using the current single large vi I have instead of subvis to implement the state machine. My sequence is not defined - in order words I can go from state 1 to 10 or 9 or 7. It should be able to move from anyone state to another.

[BADGE NAME]

0 Kudos
Message 8 of 39
(3,358 Views)

@blessedk wrote:
Basically I want to be able to apply a short "true " pulse to a while loop condition terminal and then return that to false after a second or so. I don't want to do this with a Boolean switch. I prefer the user clicks the OK button to generate a short-lived true pulse.

I realize that you have "moved on" from this question, but when I tried to answer it this morning, I discovered that while I could read the Forums, I couldn't Post (nor could I log in) -- sounds like maintenance was in progress.  I did code up a possible solution to this problem, so I decided to post it anyway for your amusement.

 

I notice that though you've been visiting the Forums for a while, there is no code posted here with this question, so I cannot tell what version of LabVIEW you are using.  I'm posting this as a LabVIEW 2015 Snippet, so if you have LabVIEW 2015, you can easily grab this code and try it out.  If not, this might encourage you to Post Code (or at least tell us your LabVIEW Version).

 

This is the Initialization part of a sub-VI I call "Brief True".  You put it whereever you want a Momentary True to "latch" for a period of time (another parameter to the sub-VI, default is 1000 msec).  If Momentary True is off and Start is True (illustrated), this saves the "Stop Time" in a Shift Register and turns on Momentary True.  Subsequent calls (in the Case not shown) just compare the Current Time to the previously-saved Stop Time and set Momentary True to "Current Time < Stop Time", ignoring the Start command.   

Brief True.png

Here is a Test Routine that shows how this works.  The Start Button is a Latch When Released control, so it acts as a Momentary True switch.  The Brief True sub-VI turns it into a 1-second True indicator that we test 20 times/second.

Test Brief True.png

You described doing this with an Error Line -- you could either simply use Brief True on the Status component of the Error Cluster or adapt these routines to use the Error Line instead of a Boolean Input and Output.

 

Bob Schor 

Message 9 of 39
(3,338 Views)
Thanks Bob. I use Labview 2015. The brief true vi works and I definitely appreciate and learnt from it!. However, I now understand that this won't solve my particular problem. What I may actually need is how to restart the loop apart from some kind of state machine that allows me to re-run sections of code arbitrarily/ at random. I am actually currently looking at some other discussion that suggests the use of inner loop in case structure both bound by an outer loop, but another issue I envisage is that even if I encase a section of my block diagram in this type of combination, my outer loop ( which has to encase the entire block diagram) will not complete one iteration until it has gone through all other sections of the code which I guess defeats the aim. lI have a single large vi ( which I should have broken down into subvis as the block diagram was growing.) which is now too difficult to break down into subvis and try the state machine approach so I am looking for some other means that allows me to execute any section of my block diagram again and again as much as I want irrespective of data flow or the sequence of the codes

[BADGE NAME]

0 Kudos
Message 10 of 39
(3,310 Views)