08-23-2022 07:44 AM
can someone explain the working of this solution?
08-23-2022 08:05 AM - edited 08-23-2022 08:06 AM
The code runs from left to right. The Voltage Source is first disabled (its "Disabled" property is set to Disabled, user can't edit it) and then repeatedly (in while structure), user is asked for a password. Actually he is asked only after he fires the event in the event structure (after UNLOCK button press). If the password is equal to 123456780, the "Disabled" property is set to Enabled.
08-23-2022 08:09 AM - edited 08-23-2022 08:10 AM
08-23-2022 08:15 AM - edited 08-23-2022 08:18 AM
Well, we can make some assumptions about the picture. But there is more code hidden than shown. So, assuming:
None of those assumptions can be verified from a PICTURE! so please, post a code capture or a snippet or attach the VI.
The "Solution" is a silly way to prompt the user for a string whenever the control with no name's value is changed. The user input string from the prompt is compared to a constant value of "1234567890" to select the case (Silly, the cases could be "1234567890" and Default the comparison is extraneous)
08-23-2022 09:40 AM
@Chirag4646 wrote:
can someone explain the working of this solution?
If it might be "working", it is probably not a reasonable "solution" to whatever you are trying to do. Who wrote it? Where did you find it?
If it is not your code, you need to give us a link to the previous discussion or to wherever you found this.
As has been said, (most of the time) we cannot tell much from a picture, except that whoever wrote this code is probably a beginner and not very familiar with LabVIEW programming, because there are glaring problem, the first is having an event associated with a control that has no label! Having a "password" as plain diagram constant lets anyone with a hex editor crack it within seconds. Pointless. The sequence structure is not needed if coded correctly.
There is way too much duplicate code! I assume that in the FALSE case, the control gets disabled, so why is the property node not after the case structure? Why do we even need a case structure if a "select" would be sufficient? Only one instance of the property node needed! Why is the error diagram constant "handmade" instead of nicely aligned fresh from the palette?
What's in the other event cases? What is the purpose of the code? How does it fit into the rest of your {hopefully more interesting) project?
08-23-2022 09:51 AM
@VitSlaby wrote:
The code runs from left to right.
Execution order is completely determined by dataflow alone. In this case it is forced by the pointless dangling error wire that never really used to carry any useful information.
Left and right has no real meaning and in this case you are only correct if the specific button is pressed after the Vi is run and the visible event fires for the first time, then in goes back (right-to-left!) to the even structure due to the while loop.
08-23-2022 10:19 AM
thanks for the replay, I want to know the working of this code
Link: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000fz38SAA&l=en-IN
08-23-2022 10:26 AM
@Chirag4646 wrote:
thanks for the replay, I want to know the working of this code
Link: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000fz38SAA&l=en-IN
Did you read the explanation in the link? The code is written in LabVIEW and very simple. If you don't understand LabVIEW, it is pointless to explain further so I recommend to start with the learning resources listed at the top of the forum.
Do you have any specific question about this program? What part don't you understand?