11-13-2009 04:10 PM
how do I implement an if else statement on LabVIEW? I am trying to use Mathscript.
eg. input I into mathscript. C and D are outputs but will be using only one according to if else statement
if I =1 or 2 or 3
C=I and do a case structure
else
D=I and do some other structure.
When I do this, error is "LabVIEW: The given name does not correspond to a known function, variable, or symbol."
It is just that I have to use one of the 2 outputs at one time.
V
11-13-2009 05:10 PM
Is that you actual syntax? Have you looked in the Help under Mathscript? The syntax is fully documented.
If that's all you're doing with Mathscript then it's overkill. Why don't you just use plain ol' G-code?
11-18-2009 02:47 PM
Hi guys,
I went through Mathscript help and now I hv got it working.
My case structure has a condition where if it occurs, while loop stops which stops the program. But wht seems to happen is that the serial port reads the next command faster than the while loop timer and so the loop ends and starts again because the serial read buffer has the command.
My question now is. ... How do i correct that? How do I make sure that the condition stops the while loop so that even if the serial port has read the next command, that condition doesnot start the while loop again?
V
11-18-2009 03:30 PM
11-18-2009 03:32 PM
11-30-2009 11:10 AM
HI Guys,
Sorry for the late reply to your posting. Was caught up with something else and Thanksgiving.!! 🙂 I cannot attach the whole program, but I am attaching a simulation of the control program I am using. The main part that I am looking at is the Serial communication.
Like I had mentioned before, the problem with the program's while loop ending and starting again is Resolved but in many cases it happens again.
I have one more problem now. 😞 If you take a look at the program, serial communication breaks when Start/Stop phase occurs (I have replaced a huge case structure with Start/Stop LED) What happens is when Start/Stop Boolean control is true, labview takes over running the Start/Stop case structure that results in break in constant communication. Only until the case has completed does the communication continue. BUt, what I need is communication through serial port at all times, even when control is transferred to the case structure. Does that mean that I have to include the serial communication blocks inside the Start/Stop case structure?I hope my question is clear. Please let me know
VJ
11-30-2009 11:14 AM
FYI, there is no HUGE case structure in the simulation I have attached, but assume instead of the Start/Stop LED, there is a huge case structure that runs for 18 min. 🙂
V
11-30-2009 11:18 AM
VeeJay wrote:there is a huge case structure that runs for 18 min. 🙂
18 min
![]()
11-30-2009 11:20 AM
11-30-2009 11:25 AM - edited 11-30-2009 11:27 AM
VeeJay wrote:Like I had mentioned before, the problem with the program's while loop ending and starting again is Resolved but in many cases it happens again.
If it still happens then it's not resolved, now is it?
I have one more problem now. 😞 If you take a look at the program, serial communication breaks when Start/Stop phase occurs (I have replaced a huge case structure with Start/Stop LED) What happens is when Start/Stop Boolean control is true, labview takes over running the Start/Stop case structure that results in break in constant communication. Only until the case has completed does the communication continue. BUt, what I need is communication through serial port at all times, even when control is transferred to the case structure. Does that mean that I have to include the serial communication blocks inside the Start/Stop case structure?I hope my question is clear. Please let me know
I have no idea which is the "Start/Stop" case structure. There are 4 cases, but none are labeled, so only you know what they are. I have some comments regarding the code: