LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to simultaneously read and write with having their individual pop up windows

hello everyone,

i want to maek a vi which have read and write functionality. now we want separate windows for both operations. I am attaching my vi's here,so plz take a look and tell me what are the changes needed here?

My problem is at a time it runs only one functionality and freezes main vi front panle.So i want to do is user can able to go any of the three windows and parallel process should be going on.

Here i am attaching my vis....

Note: I am working on labview 10 and have X series DAQ USB-6343 

Download All
0 Kudos
Message 1 of 8
(3,536 Views)

Classic type of abusing Events. You should have only a single Event structure!

Your buttons should be in their Event structure case where they belong. You do not use the Event's timeout case for anything, you do not need it!

When you start these pop-up subVIs in an Event structure, it will not be responsible any more, that is why it hangs...(one reason actually) Your timing also does not make sense here.

Sorry but what you do is also wrong inside the subVIs (Read/write), the Read subVI initializes the HW at every iteration and closes it. The Write subVI is also strange a bit, double while loop? Error handling is not developed in overall neither.

In this case you could use a single Event structure, and you could dynamically call the subVIs but of course you have to fix their code too before you do this.

Other possibility is to use a Producer/Consumer (Events) design pattern with two consumers: Read and Write.

 

Actually why do you need Event structure at all? Why do you need two separate windows for this simple application?

As I see, you only want to have a Read and a Write HW task running in parallel, independently each other. Just simply use two while loops running the two DAQmx tasks. And a single stop button in one while loop, and (as a quick and dirty solution) a local variable of the stop button to stop the second while loop.

 

You should try to understand how an Event structure works before you try to use it. Look at the shipped design patterns, you can learn from these. I also recommend to go through the online teaching material (if you have licence, you can get access), at Core-2 you can learn about Events.

 

Edit1: Another simple solution, and you get your two separate front panels: just create the two VIs for Read and Write, and you can run and stop them independently...

Edit2: about the Event structure: this is mainly to capture user interface events when the user interacts with it. You should never put any code (or subVI) inside an Event structure which execution takes lets say more than 100 msec, since you will lose its responsiveness.

 

 

0 Kudos
Message 2 of 8
(3,516 Views)

hie....

you wrote...

-------------

In this case you could use a single Event structure, and you could dynamically call the subVIs but of course you have to fix their code too before you do this.

Other possibility is to use a Producer/Consumer (Events) design pattern with two consumers: Read and Write.

-------------

 

can you plz tell me more about this paragraph..?

 

and my original need is, We have two different files which i have to merge but because of many front panel indicators and graph i was told to do it in different windows, So i make this project to prove programming concept only,you can say beta version.In my application we are reading data every 1 Second and if user press some buttons it will write some data.

 

So as per this requirements plz guide me and Plz give link for good Producer-consumer method and examples....

 

and if possible for you attach edited files.

 

thanks & regards, 

0 Kudos
Message 3 of 8
(3,491 Views)

"We have two different files which i have to merge but because of many front panel indicators and graph i was told to do it in different windows,"

 

No, in principle if you have too many GUI objects, you can can use a TAB container (Controls->Containers->TAB control from FrontPanel menu) with multiple pages, much simpler.

Well, LabVIEW Core 2-3 learning material contains some of the design patterns. Also, you can open design patterns from your LabVIEW. Sorry, I do not have time now to put an example together.

0 Kudos
Message 4 of 8
(3,478 Views)

hello all..

i have prepared vi using TAB control but requirement is this kind so what should i do..?

0 Kudos
Message 5 of 8
(3,470 Views)

I made a very simplified example, the error handling (and other things too) should be fixed and revised.

It is only to show you some idea what you can do with a simple state machine, even without an Event structure. This minimal example runs an independent continuous DAQmx Read task, and a parallel state machine is used to trigger some DAQmx Write task. During this task there is no way to abort it, if you need abort functionality, you have to implement it...

 

I strongly advice you to learn more LV, if I had a time I could put together a more advanced example, but if you do not understand the concept whats the point? It is better to advance in smaller steps. Learn about state machines (and about typdef enums, etc.), and other basics before you move to the Event programming...Also, it is advised to use a project file, where you store your MAIN vi, your subVIs, your type defined controls...

 

 

0 Kudos
Message 6 of 8
(3,454 Views)

ohk i will start learning it and post it later my doughts,But can you tell me is it possible TWO pop-up windows with paralle executiona....?? And thanks so much for helping and if it is possible for you plz  post some good example LINKs 

0 Kudos
Message 7 of 8
(3,431 Views)

Sure it is possible, I just wanted to show you more basic alternatives. Here is a link for one possible way:

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/acbr_call_and_forget/

I just started to use this dynamic call type a few days ago, for a pop-up window, and I got good advices from the more experienced, you can find the discussion here:

http://forums.ni.com/t5/LabVIEW/pop-up-dialog-async-call-and-forget/td-p/3090634

 

So you need a SINGLE event structure, and you can call your two subVIs from there. It is also recommended to create an ActionEngine (you can read about them here, very useful things!: http://forums.ni.com/t5/LabVIEW/Community-Nugget-4-08-2007-Action-Engines/td-p/503801 ) where you can store UserEvent Refnums so you can inform the main vi whether the subVI was closed, etc...(see my above forum post).

 

Some more links:

http://www.ni.com/white-paper/3331/en/

http://zone.ni.com/reference/en-XX/help/371361K-01/glang/event_structure/

https://www.youtube.com/watch?v=8eO64fo3Pho

http://enableintegration.com/blog/labview-tutorial-27-the-event-structure/

 

User Events:

http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/creating_user_events/

 

 

And a short tutorial with many basics:

http://www.uio.no/studier/emner/matnat/fys/FYS3240/v11/undervisningsmateriale/forelesninger/Lecture3...

 

If you have active LabVIEW licence, you can access the online self-paced-learning:

http://www.ni.com/newsletter/50764/en/

 

0 Kudos
Message 8 of 8
(3,415 Views)