Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Choosing the proper structure

I would please like to ask whether the event structure is more efficient to use in an application where one would like to respond to user interface. I mean in an aplication where for example data are exchanged between a PC and an instrument, the user has an option to write the data into a file. But the file I/O is in progress only as long as the particular control is "true". Than it is terminated however the program is still communicating and exchanging the data with the instrument. What I would like to know is whether the event structure can be used for such an example. Because what I red is that it responds to one and only event. Therefore if the event of pressing the File I/O button occurs it writes just one value and stops. Can it be programmed a bit like the case structure that as long as the control is in high, the subroutine of file I/O is executed. What I was thinking of was using a case structures in a while loops nested together but the problem over there is that as long as the data program executes the code within the inner while loop does not reflect the user input . Any advice is appreciated. Yours Sincerely

Karlito
Message 1 of 4
(3,650 Views)

Hi

Ofcourse. As i understood from your description you can use a case structure instead of event structure.

First of all you have build an array with the controls as the elements, and it wil be having indexing also. So using this index you can control the case structure and in every case you can have as much functions you want. You also have to create an additional case which dont have a selector and make this case 'default'. Do not place any of the functions in this default case. It will enable you o be idle when you are not clicking any of the button or control. You have to put this case structure inside a while loop so that it checks every time for an input to the case selector of the case structure.

I hope this will help you.

Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 2 of 4
(3,643 Views)
You are mixing actions of a user who changes a knob with actions of the program.
The users changes from yes save data to don't save data.
The program looks after each measurement point at the value to see if it has to save this value.
So you need a case after your measurement and if you want to respond immediately to some other button (update soething) you can do this in the event structure.
The don't exclude each other, you need both structures.
greetings from the Netherlands
Message 3 of 4
(3,642 Views)

Hi,

perhaps you should have a look at the Producer/Consumer Design Pattern (Events) in the Template Browser of LabVIEW. Try to understand this architecture. Afterwards you can mix it with dynamic events.

 

Best regards

Alex R.

NI Switzerland

Message 4 of 4
(3,622 Views)