Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure

Hi Dev:

 

The program doesn't again. I tried to make the button to switch when pressed. You said at the end of the event structure, put a property node.I don't know. I made one in my attachment, could you please help me to fix it?

 

The reset channel that you mentioned last time. I have two more push buttons needed to add to the event structure. One is Bark and another one is test. I don't care which push buttons I pressed, the reset is needed to reset the fixture at every single state of the push buttons. The enable needed to stay, once reset is pressed, every things is reset. Not like I pressed the enable and I need to press reset, I may press bark. Do you have any suggestions

0 Kudos
Message 21 of 63
(1,791 Views)
Here is the file
0 Kudos
Message 22 of 63
(1,786 Views)

Hi,

You can add any more butons and events with add event case.

it will support any more event you want to add.

Here, you can add anther Reset  button also.

I have modified the VI once again, included property nodes for setting boolean logics, hope this will suit your purpose, have a look

and this other VI, dev1.vi (NI scope vi) which is for acquiring from your 5112, where do you want it to be executed?

Regards

Dev

 

 

 

0 Kudos
Message 23 of 63
(1,782 Views)

hi Dev:

Thanks! But I found I still need to hit "stop acq" button to stop acq.

In normal opeartion, see my attacted graph. The opearator is doing the following steps.

1) Press "Reset" button

2) Press "Enable" button

3) Press "Bark" button

4) Press "Test" Button

He does not need to press "stop acq."one more button.  In Labview, can Labview make it simply like the real opeartion or it need to do it this way. Also, I also need to make a green light and red light to indicate the opeator the current is pass or test is pass. Do you think I can put this light into the enable event structure case in your to do it. if so, can you please suggest me how to do it?

I have the ni5112 program in my "DEV.vi" because I want to press the bark button and then show the waveform. That is why I have this program. Do you think I put it in the right place, I put it above the event structure.  

0 Kudos
Message 24 of 63
(1,778 Views)
Hi,
 
Putting the 5512 acq VI in the Bark event structure should not cause any problems.
 
About removing the  stop button for acq, if you have any idea as to how many seconds you want to acquire from the 6250,just do the following.
 
Acquire for that many seconds and write a logic to stop after that many iterations( count 10/20 iterations and stop while loop)
This should help.
 
Happy weekend
 
Regards
 
Dev
 
 
 
 
 
 
 
 
 
0 Kudos
Message 25 of 63
(1,769 Views)

Hi Dev:

 

Putting the 5512 acq VI in the Bark event structure should not cause any problems.
 
1) But, the "bark" button is a push button in event structure. The mechanical action is switched when pressed. So, there is two action. The first action is the button light off, it execute the 5112 acq VI event in the bark event structure, then it goes to the timeout event. It will wait until your press another button. I wonder why you don't have a -1 in timeout symbol on the left corner?  The second question is when I pressed the "bark" push button again, i think it will go from timout event case to bark case again. will  5112 acq VI program will execute again? Am I thinking something wrong here? Could you correct me? if something wrong, could you tell how to do it here? 
 
About removing the  stop button for acq, if you have any idea as to how many seconds you want to acquire from the 6250,just do the following.
 
Acquire for that many seconds and write a logic to stop after that many iterations( count 10/20 iterations and stop while loop)
This should help.
 
2) What do you mean here? Do you mean think of how many seconds first before doing the subvi program one acq.vi?
My project is to read a current in a 100ohm or less resistor? As you know, this small resistor vaired a lot in Labview, not like DMM.
In order to make it like DMM, I need to take average which is 1/10 second. Could you please tell me what you mean here? I don't get it.
Is it still possible to make operator feels like a real situation using Labview and could I put a test and fail read green light button in your program?
 
3) Also, you mentioned there is a time that need to consider before DAQmx read.vi in my old file. I would like to ask why the one acq.vi doesn't need to take that time count out. You said that that part is set it once and I don't need to adjust any parameter in one acq.vi, but in my old program, I just tried, I hit the run button and I am not doing any thing changes in sampling rate or number of sample. That is the same thing as your one acq.vi. I know that there is a 1ms timeout count. the measurement is not accurate. But I am not clear about the one acq.vi. do you mean I don't have to care that part before the DAQmx read.vi casue I am not doing any count of that. I am doing the count on the DAQmx read part in the while loop. Isn't that the main problem is the timeout case time? Can you verify me here and if I am thinking wrong, could you correct me please?
 
4) I tried your new program. It seems the program does not control the reset button and my enable button, why?
Attached is my program. It can control the enable button. Could you tell me why?
 
 
 
0 Kudos
Message 26 of 63
(1,769 Views)

Hi,

Q1.

When nothing is connected to a terminal, it takes its default value as input, so event case's timeout is -1 by default, so you need to wire a value if it is other than -1. Also read how event structures work form the Labview help.

The default is –1, indicating never to timeout, or VI keeps waiting fo an event to occur.

this link should give you an idea how to use events.

http://zone.ni.com/reference/en-XX/help/lv/71/lvhelp/CaveatsRecmndtnsEvnts/

Each time you press bark button, your 5112 code will execute once( because your code is for finite acquisition) and display the values/graph.You have understood it right.

Q2
This i suggested if you want to do away/remove the stop button in one acq.vi.
In other words, if you do not want the user to stop  continous acquisition by using a button, you can stop this automatically by using a seconds count.
 
Q3.
Your old program used to be a finite acquisition, working like this: configure channels ->  start acq, ->acquire for 1/0 sec,->stop, then do all these things again from first step, on each iteration of while loop.
Where a,  my one acq Vi is an example of continous acquisition.Once you configure, you keep acqiuiring at regular intervals in every iteration of while loop.
Finite acq acquires a predetermined number of samples using hardware timing, and stops.
Whereas,  continous keeps acquiring a preset count of samples at equal intervals using hardware timing, till you give a stop command or set a condition to stop the acquisition.
 
I sugest you read DAQ tutorials and also take a look at labVIEW analog measurements Example VI's to get an idea about finite and continous acquisitions.
This should clear any confusion you have about this part.
 
Q4.
I tried it and reset and enable buttons do work.
This i was able to determine this since the respective cases do get executed.
I have attached same Vi, with a dialog box popping up when ever u press enable and reset, and this will give you a confirmation that these buttons have worked.
 
Do mail back if you have any more doubts.
 
Regards
 
Dev
 
0 Kudos
Message 27 of 63
(1,744 Views)
0 Kudos
Message 28 of 63
(1,743 Views)

Hi Dev:

Q1.

Each time you press bark button, your 5112 code will execute once( because your code is for finite acquisition) and display the values/graph.You have understood it right.

You said my code is for finite acquistion. my 5112 code will execute once in "bar" event case. It will go to timeout event case and then you hit "barK" push button again to turn the light on, it will execute the 5112 code again. Am my understanding correct here?

Also, I need to tell you the real situation of my test fixture work. The :"barK" push button will display the vaulue/graph when I hit the real "bark" push button on the fixture. When I press "bark" pushbutton, it will generate the graph. When I release the button, it will not do anything. Then when I hit "bark" again, it won't do anything.. That is how it is.

You mentioned the 5112 code will execute once when I press "bark" each time. What happened when I release "bark" in Labview, what will happened, will it hang the program because my program is connected to my hardware (test fixture). It is supposed to work like a normal operation with connecting computer, right? How can I fix this problem in my code?

Q2

This i suggested if you want to do away/remove the stop button in one acq.vi.

In other words, if you do not want the user to stop  continous acquisition by using a button, you can stop this automatically by using a seconds count.

 

Can I use the for loop in this case and add a timer instead of while loop is this case?

Why is always reading something in another window, do you think you can read the same thing in the same interface in main.vi or there is no other way? I would like to be sure.

 

0 Kudos
Message 29 of 63
(1,734 Views)

Q3.

Your old program used to be a finite acquisition, working like this: configure channels ->  start acq, ->acquire for 1/0 sec,->stop, then do all these things again from first step, on each iteration of while loop.

Where a,  my one acq Vi is an example of continous acquisition.Once you configure, you keep acqiuiring at regular intervals in every iteration of while loop.

Finite acq acquires a predetermined number of samples using hardware timing, and stops.

Whereas,  continous keeps acquiring a preset count of samples at equal intervals using hardware timing, till you give a stop command or set a condition to stop the acquisition.

 

I read the tutourial. The difference is the number of point that acquire the samples. One is finite acq. Another is continous one. In my old program, I can see it right now, I don't have the while loop, the while loop is outside the event struture. So, did you mean since the finite acq. without while loop acquire a predetermined number of samples without continous keeps acquiring a preset count of samples at equal intervals then it will stop when you press another buttons? If yes, That is why  it need to take time before DAQmx read. Am I correct? If I put a while loop in my old program  like your need file, would that idea work?

 

Q4.

I tried it and reset and enable buttons do work.

This i was able to determine this since the respective cases do get executed.

I have attached same Vi, with a dialog box popping up when ever u press enable and reset, and this will give you a confirmation that these buttons have worked.

 

I would like to try this to see what happen first.

 

 

0 Kudos
Message 30 of 63
(1,769 Views)