Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggered Counter Output, need help with AI Triggering

Hello all, I am looking for some guidance on my VI.

 

What I would like to accomplish with my PCI-6251 is pretty simple I think, but I am not too familiar with DAQmx. I want to use the voltage signal from a pressure transducer (analog input) to trigger a digital pulse (counter output). I have found that an analog trigger is not capable of triggering a counter output.

 

I have a functioning VI which sends the pulse, which I have been testing with a function generator and digital trigger. It behaves exactly as I desire, but I need some guidance on how to trigger this VI with an analogue signal. I have to imagine that a digital edge could be created and used for the counter output, but I am having trouble doing this.


Any pointers would be greatly appreciated.

0 Kudos
Message 1 of 7
(4,214 Views)

Hello Darrbene, 

 

Although you cannot directly use an analog signal to trigger a counter task, you can indirectly accomplish this by using an analog start trigger. This analog start trigger is generated when your voltage signal from you pressure transducer crosses a threshold value. Then you can route that analog start trigger to a counter output task in order for it to begin it’s operation. Please take a look at the snippet below which creates the feature you are looking for.

 

CE.png

 

Note this example utilizes the analog input and counter on the same PCI-6251 thus I did not need to export the start trigger to a PFI line and could just point the counter task to the ai/StartTrigger.

 

Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 2 of 7
(4,193 Views)
Thanks Izzy, It sort of worked. The counter will pulse when it sees the signal from the pressure transducer as I expect. The only problem I have is the pulse occurs every other rise from the pressure transducer. What may cause this? I have attached the VI I am using.
0 Kudos
Message 3 of 7
(4,171 Views)

Hello Darrbene,

 

I believe you forgot to attach the VI. In the snippet I previously attached the counter task only responds to the signal from the pressure transducer once. When the pressure initially goes above a certain threshold then the pulses are continuously generated. If you want the pulses to be generated only when the the pressure goes above a certain threshold then please take a look at the modified snippet below.

 

CE1.png

 

The above example generates 10 pulses from the counter when the AI voltage exceeds 2 volts. 

 

Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

  

Message 4 of 7
(4,166 Views)

I have attached the VI and I have attached an image of what I am seeing on the scope. Yellow is the transducer and blue is the counter output. Could it be that I am overloading the processing capability of the board? The problem gets worse when the pressure transducer runs at higher frequency, its sends the output ever 3rd rise.

Download All
0 Kudos
Message 5 of 7
(4,159 Views)

Hello Darrbene, 

 

1. Which VI did you use that created the image you attached, mine or yours?

 

2. How are you triggering the Counter Output with your code? I see that you have pointed it to the PFI0 line. Although how is the trigger connected to that line? 

 

3. How are you ensuring that the Counter Output task does not miss the first rising edge from your pressure transducer? In my VI I did this by ensuring that the counter output task started before the analog input task and was looking for that trigger.

 

4. Why do you have a while loop around both tasks?  This is not recommended because on each iteration of the loop your analog input task goes from create channel to clear task. If you are trying to set up repetitive analog triggers this is not needed because the analog comparison event is always occurring while the task is running.

 

I would recommend, if you haven't done so, to take a look at the lates example I posted and attempt to implement it. Please let me know if you get similar results with the example so I can further assist with this issue.

 

Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 6 of 7
(4,150 Views)

I made the changes used in the example you posted and it works perfectly now.

 

Thank you so much for your help Izzy it is very much appreciated!

0 Kudos
Message 7 of 7
(4,131 Views)