LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

few doubts in labview events

Hi all, 

I have the following doubts regarding labview.

 

1. I have a simple boolean button switch. How do I catch the event of the button while the program is running and do something based on whether its true or false.

 

2. I have written a program that writes some values to a device through serial port. When I click run, the program writes the values and stops. I want it to still run and wait for events in the buttons and write data whenever this happens.

 

3. To select the visa resource name for the communication, there is a control that I have placed, everytime, I select only COM1, so if I create a constant for the parameter, how do I set this constant to COM1 port in my system.

 

4. I have a set of values to be written at once to the device through serial port, but I need to give a gap of around 4ms for indicating message end. So, I have implemented a flat sequence structure with a timer at each block. Should I wire this timer with the values that goes from one block to other or just giving a time of 4ms to the timer will stop this block from being executed before the other one? Its because, once I communicate with the machine, only after that it should wait for 4 ms. So how can I put both these in the same block of the sequence structure.

 

Thanks everyone in advance 🙂

 

VJ 

0 Kudos
Message 1 of 4
(2,704 Views)

Hi VJ,

 

1) event structure, event "button value change"

 

2) put a while loop around your code...

 

3) make a constant from your control (right-click the terminal...)

 

4) put the "timer" between the frames of the sequence, i.e. add a frame in between

 

But from your questions it seem there could be some problems in vi design in general. Could you attach your vi here?

And to learn more about LabView you should go here...

Message Edited by GerdW on 02-25-2009 10:09 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,695 Views)

Hi GerdW,

 

Thanks for your reply.

The 2nd isn't clear. If I create a constant, what value should I give for the resource name. It doesn't show up in my system because I program in my system and deploy it in my lab where there is no labview. So when I create the executable, how do I select the value for the constant.

 

In the 4th one, can't I do better, rather than inserting a frame just for time? I am a novice in labview programming, so I dont know to use the structures efficiently 🙂

 

I have attached the block diagram  with the post. 

 

Thanks for your valuable inputs.

 

VJ 

Download All
0 Kudos
Message 3 of 4
(2,676 Views)

Hi VJ,

 

as the timeout is used in every frame you should move it into the "write whatever" subvi. Whenever something is used regularly (more than once) it makes sense to create a subvi for this purpose... After that change you don't need the sequence structure at all as dataflow predicts execution order (by error cluster and reference wires...)!

 

Why don't you use a two clusters for all those settings? That way you only need one selection operation instead of those 8 selections between settings1 and settings2.

Message Edited by GerdW on 02-26-2009 09:55 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,632 Views)