03-06-2024 10:33 AM
I apologize for not clarifying. Everything I have in that file I can use. Just cant add anything. So the number constants, while loop, case structure, stop terminal, greater than or equal to, True/false constant, one text box, get date/time, date and time. They're all acceptable.
03-06-2024 10:41 AM
I changed it to 2017. The stop terminal isnt supposed to be hooked to the false constraint. Suppose to have a separate button. Also I do know what a while loop does, just not for this. We were left in the dark about this part. I'm assuming he thought we didn't need to know.
03-06-2024 12:07 PM - edited 03-06-2024 12:25 PM
See if you can get this working, then adapt it to your convoluted requirements.
Somewhat cleaner would probably be the following. try to understand the logic!
03-06-2024 12:48 PM
I looked at your diagram.
Without seeing your explicit directions and not knowing whether or not this VI was provided to you or what let me summarize.
Originally you were provided the following constants (I am assuming):
1000
5
false
Text 1
Text 2
So now you have modified one of your constants to 5000. (Why? Did your instructions tell you to?)
Your functions are
Wait(ms)
Greater than or Equal to
Get Date/Time String
You have a control to stop your while loop, and indicators for Text, Date, Time.
Now, you indicate you are aware of what a while loop does, but you still are not using the iteration terminal. Your usage and understanding of the Wait(ms) function is also an issue. Reviewing the context help, or Help, you would see that the Wait(ms) output terminal millisecond timer value returns the value of the millisecond timer after the wait. So I am asking you, if you wire the input terminal to 5000, how many seconds will you be waiting, for 1 iteration of the loop to complete. Secondly, If you wait that long, do you have any guess what the OUTPUT of the function will produce (it won't be what you'd expect). How can that number ever be less than 5? Furthermore, when you use the output terminal, every function that is in the data flow sequence of that needs to wait. Hit the light bulb on your block diagram and click run. Watch the block diagram and see what is happening. That is the data flow. It will also show you what values are coming down the wires.
I really don't think that you have been left in the dark nor have lack of information being provided to you. The requirements are a bit unclear to US, the outside observer but if you are asked to use ONLY what was provided then this is what we must do. WE have to wire things to the appropriate locations to get the VI to run, we can't add additional things, modify constants, add nodes etc....We take what we are provided and solve the problem.
Your Get Date/Time String function has a boolean terminal on the input side of it doesn't it? Do you suppose this would be a good terminal to wire your false constant to? Do your requirements want you to change the value of the false constant to a true? We can't answer this for you without you telling us exactly what they wanted in terms of the date and time indicators.
So once again, ITERATION terminal. What does that do? How can that help you? Incase you never actually went to the links provided earlier, here is a picture of a while loop, utilizing the iteration terminal.
03-06-2024 12:55 PM
@Kavanakt7 wrote:
here is a picture of a while loop, utilizing the iteration terminal.
That "iteration count" indicator outside the loop will only show an "interesting" value after the loop has stopped correctly via the stop button (or never if the VI was aborted) and is thus not very useful.
03-06-2024 01:08 PM
Thank you all. For some reason, didn't think that the "i" in the while loop could be used. Now I see how I can use the greater than comparator and return true/false readings at certain times.
03-06-2024 01:28 PM
@Kavanakt7 wrote:
I do not know the context of your class, but with no programming experience some of these concepts are likely foreign to you. This link Build and Configure a While Loop in LabVIEW (The examples utilize tunnels to update the iteration count outside of the while loop, you don't want that feature, you need to know your current iteration which can be found from inside the while loop)could be useful. Here is another useful link LabVIEW For Loops and While Loops Explained.
Yes, my previous comment remarked on the iteration terminal inside vs. outside the loop. I was hoping we'd get to the conclusion eventually. Thanks altenbach for pointing that out!
03-06-2024 01:39 PM
@dmg1701 wrote:
Thank you all. For some reason, didn't think that the "i" in the while loop could be used. Now I see how I can use the greater than comparator and return true/false readings at certain times.
The iteration terminal together with a comparison is not useful, because the the output will change a maximum of once (or maybe even never!) unless you add a lot more code. I thought that the requirement is that is changes back and forth forever.
Have you looked at how I used it earlier (last picture here)?
(... and please don't mark answers as solution if they don't answer the original question)