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.
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.
12-19-2012 09:36 PM
I'm having trouble using a case statement with a string. The Cal Calling button sometimes lights but the send message never goes when the proper string is received. I do not have this problem if I use the case statement as True/False and use the output of the equal to.
Suggestions please.
12-19-2012 10:45 PM
What do you mean by proper string? The string given in the case structure? If that is the case even if you have a space in the input/the string defined in the case structure they won't match and the case structure won't execute.
12-20-2012 03:28 AM
Hi,
I can see that you have edited the udp example that ships with LabVIEW, that's usually a good place to start.
You've introduced some errors that you will want to get sorted before moving on.
Firstly, what is the second (outer) loop doing? The inner while loop will keep reading/writing data until you press the stop button. The second loop will then wait a second and start the reading/writing loop again. This isn't really necessary.
Secondly, you've got a potential race condition because of your local variable of 'cal calling'. It'd be better to wire to the indicator icon directly.
But the main problem is that your case structure will never execute the "REQSTAT" state because you have wired two constants ('OA' and '5245 5153 5441 540A') to the 'match pattern' vi. Therefore you will get the same answer out each time and this will never equal REQSTAT!
You probably want to wire the 'Data received' string into the 'match pattern' vi instead of the constant.
-CC
12-20-2012 06:14 AM
Thanks. A fresh eye is also better and sleep is good. I changed the input to the matched pattern; I'll be able to check it later. As far as the double loop: It does look a little strange. Wrote the code awhile ago so I don't remember the rationales. This is a sub vi. I need to look into this a little more.
12-20-2012 06:18 AM
@exo wrote:
... A fresh eye is also better and sleep is good.
Very true!
Feel free to post pack again when you've had a look at it whilst properly awake!
-CC
12-20-2012 06:25 AM
New Code
Unfortunately, I don't sleep.