LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select the specific channels attached to specific "create virtual channel"

Solved!
Go to solution

You're probably thinking too linearly here with respect to the tabs. You don't neeeed tabs, all the controls can be displayed at once, it's up to you. The application is your playground, you can make it switch tabs, you can make it trigger a specific state, you can do whatever you want. Personally, I wouldn't make it change tabs for the user, let the user change the tabs themselves.

 

In order to keep a continuous amount of data coming in to your plot during the acquisition state, you want to implement a second loop that just does the acquisition. The "Acquire" state in your main loop can trigger this loop to acquire. Then the "StopAcq" state (or whatever you want to call it) can trigger for that loop to stop.

 

I got a little carried away and altered the last VI you attached here to do this. You'll have to edit your version to include the Start and Initialize, or whatever buttons your want, because I just did the Stop button case. I disconnected the type-def state control as well, so you just want to edit your version once learning from mine.

I also edited your File IO express VI to not prompt the user, that would seize up the loop until the user finished and could result in lost data.

There is a horrible lack of error handling in this application, but you should be fine with Automatic Error Handling for right now unless you plan on adding a whole bunch more functionality.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 31 of 35
(1,572 Views)

Dear,

 

Thank you James, your program is working a lot more fluent than mine, is this a state machine with a master slave architecture?

 

I've attached the program I have untill now, I reworked my state machine in the way it needs to be to become a real state machine, I guess. I find it very useful that the tabs change automaticaly, so the user can't click on anything wrong or something, he just needs to follow the buttons... I will also try to disable the buttons of zero and measurement when the program starts, after the users pressed the 'configurate channels' button, the other buttons will be set to able again, so the users really needs to follow the steps.

 

I will now try to implement your version into mine, because the acquisition of your program is a lot (read: enormously) faster 🙂

 

With kind regards, 

 

Peter

 

PS: Thank you for the effort to make an example! 

0 Kudos
Message 32 of 35
(1,557 Views)
Solution
Accepted by topic author PeteTheGod

@PeteTheGod wrote:

is this a state machine with a master slave architecture?


It's not a master-slave architecture because that would include a queue of commands and/or data to be communicating between the master and slave. This is really a very simple parallel While loop architecture and isn't very scale-able. You shouldn't use what I made beyond your single acquisition application because it can get out of hand really fast. A better, more complicated (but robust) architecture is the Queued Message Handler.

 


PeteTheGod wrote:

I will now try to implement your version into mine, because the acquisition of your program is a lot (read: enormously) faster 🙂


Yeah, you were pulling a single point with each loop and reinitializing the DAQmx task every time as well. So you were essentially turning this awesome hardware that can do it's own data timing and limiting it to your own loop speed. What I did was add a Timing node in the initialization state that sets that sample rate and the other loop just pulls all available data points instead of 1.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 33 of 35
(1,538 Views)

Dear James,

 

I have implemented your vi into mine, and it works! Eureka!!

Could you check my program for some main errors? I need to get started with the error handling now, what's the basic principle of it? Do I just need to connect all the error outs and error ins with eachother? 

 

After the error handling, I need to filter and process my signals, but I'm already very happy with what I have now. 

 

With much thanks

 

Kind regards, 

 

Peter

0 Kudos
Message 34 of 35
(1,525 Views)
I'm away from my computer now and for the rest of the weekend, so I can't check your VI. If it's working, that's great!

Error handling is the act of making sure any errors that get thrown are handled the way you want and/or are traceable back to their source. Your application is sooo simple that you don't need much error handling since you can find everything easily. The handling can be as simple as causing the loop to stop if there's an error or as complicated as creating an Error state that handles specific errors by code as they occur. Along with the actual error functionality, you should always wore your error clusters from VI to VI to ensure proper order of operations. You can run in to race conditions that you oversee and wired error clusters fixes the problem 99% of the time.

If you have the chance, pick a reply to this topic (or multiple) that best solved the problems you were having and mark them as the Solution, so that others can find the solution easier in the future.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 35 of 35
(1,507 Views)