02-25-2009 02:39 PM
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
02-25-2009 03:07 PM - edited 02-25-2009 03:09 PM
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...
02-25-2009 03:31 PM
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
02-26-2009 02:51 AM - edited 02-26-2009 02:55 AM
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.