LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

It is just a question

I compare one controllable string expression with two constant strings expression(equal?). Constants are "on" and "off" expressions. For this comparison; When I write "on" expression in the controllable string, it will be in true state. After that; when I sent a different expression( not a "on" and "off" expression) I want it to stay in the older state. I want that this different expression doesn't affect my comparison...

Problem:

If it is on, it will make a process, but after sending different expression; it stops...

0 Kudos
Message 1 of 9
(3,071 Views)

I don't understand what you did, am not completely sure I understand what you want to do, and certainly don't understand the results you found.

 

Attach your VI so that we can see it, can test it, can modify it, and can (I hope) make some helpful suggestions.  Speaking for myself, if you attach a picture of your Block Diagram, I promise to ignore it -- I am not interested in wasting my time trying to duplicate your code that you didn't attach!

 

Bob Schor

Message 2 of 9
(3,057 Views)

This is the simple part of my code.

0 Kudos
Message 3 of 9
(3,039 Views)

For reference, see here: https://forums.ni.com/t5/LabVIEW/Sending-Commands-via-Serial-Communication/td-p/3956057/.

 

Regarding the topic of this post, something that might help you is that you can wire (connect) things other than a boolean to the case selector (question mark) on a Case Structure.

In particular, you can wire a string, if you'd prefer. Take care for typos when you do this. An enum (How to Use Enums in Case Structures in LabVIEW) is often a safer choice.

 

Assuming that this isn't for a different project/application than described in the older thread, I'd still suggest you're programming the wrong end of this situation. You're trying to produce the simulated device - the instructions (at least to me) seem to indicate that you should be writing code to test that such a fictional device works correctly.

 

To toggle outputs, consider taking a look at something like a Producer/Consumer architecture combined with a pair of State Machines, one for each output. Have the producer (master loop) send the other loops start/stop instructions as needed, and have the two slave loops (consumers of the instructions) receive those instructions and run in one of several states (perhaps {active, inactive}, or {idle, start, running, stop}?).


GCentral
Message 4 of 9
(3,020 Views)

Thank you very much, First of all; My string values come from serial communication,I can not use enums. and case structure for strings wants at least one default value. But in this default; I don't want to do anything. I want this default value not to stop or work my simulation.I didnt solve this problem.

 

Yes, you can be right, I will think of it. But I have 2 days:D, starting at the beginning again is very hard, How am I gonna design test equipment in order to test an electronic card although I dont have any electronic card. I have known just its specifications. My idea is: My labview screen is used for my electronic card, virtual communication port is used for my test equipment.When I sent  commands, I can see whether electronic card works or not... But if I finish this problem, I have nothing to do for my ideas. If you have any idea where I can start your thoughts more clearly, please share with me...

Thank you very much...

0 Kudos
Message 5 of 9
(3,011 Views)

Problem is simple, but I dont know actually whether there is a block diagram for it. For default case; When we sent a default string variable,If simulation is on, it continues to work.if simulation isnt on, it will not do anything.So it depends on previous case. We have to retain the value when we take analog1on command.

0 Kudos
Message 6 of 9
(2,996 Views)

For simulating this problem, you can use a String Control and an Event Loop (do you know about Event Loops?) that "fires" when you change the Control.

 

LabVIEW comes with some Projects and Templates that might be helpful for you.  If you start LabVIEW and Create Project, you can choose the Queued Message Handler, which shows you how you can get "something to happen" when you change a Front Panel Control (like your String Control).  It also shows how you can "do different things" depending on the value of the Control.

 

So now you need to parse the String.  If there are only two "legal" values (such as "Turn On" and "Turn Off"), and you want to ignore everything else, you would put a Case Statement in the "Parse String" State with three choices:  "Turn On", "Turn Off", and "Default" (which would do nothing).  You'd, of course, put the appropriate code in the other two States.

 

The nice thing about this design is the code basically "does nothing" until you enter a String, at which time it does "what you tell it to do", and maybe (if you program it this way) goes back to waiting for another String (or someone to push a Stop Button ...).

 

Bob Schor  

Message 7 of 9
(2,983 Views)

Thank you very much for your reply, as you said, until ı enter a string, my program doesn't do anything but it stops, when we entered default value while it works on state.

Actually the default state seems that it doesnt do anything but it stops while my simulation is running.

 

I have watched tutorial videos about some topics that you mentioned. But I dont find any energy in body now, I need a sleep, Aftering resting, I will work on it. Thanks alot...

0 Kudos
Message 8 of 9
(2,976 Views)

I make it like that. It now works:D

0 Kudos
Message 9 of 9
(2,911 Views)