From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read and save on different files @ user required action, many values

Solved!
Go to solution

Dear all,

 

I have just finished Core1 & Core2, and now is time for me to create a project.

Title: Voltage & Temperature continuous reading and logging in separate csv based on user "save data" button change for 8 different voltage channels and 1 temperature channel (I am using DAQmx).

 

For now I created 2 different while loops:
1. continuously reads from DAQmx;

2. should continuously determine what to do based on a list of actions for 1 voltage channel and the temperature channel and here is my problem:

    2.a) I created a list of actions stored in a type def (Stopped, Init, Save Data, Continue, Stop)

    2.b) I want to observe when the user clicks the "Register" button.

        2.b)i) If it is changed to on then actions are to be made and must change de action to Init

        2.b)ii) If it is changed to on then actions are to be made and must change de action to Stop

    2.c) If "Register" value didn't change I would like to check the sift register of parent while and go to a case structure where I do actions based on the value of the action, then change the action

    2.d) How can I take the action value from one of this 2 structures: event structure/case structure and pass it to the shift register so there will be no conflict?

 

If my question is stupid, please accept my apologizes in advance, I am @ my 1st application.

 

Have a grate and healthy day!

Download All
0 Kudos
Message 1 of 7
(1,078 Views)

Please insert photos, and\or attach VIs:

Insert Photo.PNG

Capture2

Capture3

0 Kudos
Message 2 of 7
(1,023 Views)
Solution
Accepted by topic author BalajO

You probably want two loops. One for catching the events, one for the DAQ.

 

In your VI, the loop won't iterate unless there is an event. Remember data flow! The event structure won't 'do nothing' if there's no event (it will if you add a time out event), it will stall execution. Turn on execution highlighting if you don't believe this, or want to get a visual.

 

You need a way to send the enum actions from the one loop to the other. Queues are a good option (so are channel wires).

 

This will give you a consumer\producer 'architecture'. Do some searching for it, and\or look at the template (New...>Templates).

 

Core 1 and 2 cover semantics, IIRC, there are courses about architectures, like state machines, P\C, and others. This is where it gets difficult (and interesting).

Message 3 of 7
(1,020 Views)

Hello,

 

Thank you for your reply.

You gave me a good idea and I am attaching some screen shots.

From this new way, it comes a question: why if I put 10ms "event timeout" it continues to transfer the ENUM value and if I let it default (-1) it doesn't? I can't understand how the timeout is affecting the structure here. Could you explain it to me please? 🙂

 

Regards & stay safe,

Ovidiu

Download All
0 Kudos
Message 4 of 7
(1,011 Views)

Please use 

Insert Photo.PNG

instead of attaching them!

 

Capture2

Capture3

0 Kudos
Message 5 of 7
(1,003 Views)

@BalajO wrote:

You gave me a good idea and I am attaching some screen shots.

From this new way, it comes a question: why if I put 10ms "event timeout" it continues to transfer the ENUM value and if I let it default (-1) it doesn't? I can't understand how the timeout is affecting the structure here. Could you explain it to me please? 🙂


If you wire -1, the event structure will wait for an event. The time out event case will never execute (might as well (or actually better) remove it).

 

If you wire 10, the event structure will wait for 10 ms, then the time out event will execute.

 

So -1 will simply not pass anything until the other case changes the enum. 10 will pass the previous value, as you programmed this in the time out case.

 

Message 6 of 7
(1,001 Views)

Ok.

Thank you for making it clearer 🙂

I will also use the screen shots inside the message from now on instead of attaching them.

 

Many thanks for your help!

Message 7 of 7
(965 Views)