Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PFI0 digital edge start trigger not working

Hardware: USB-6009
Software: NIQmx ANSI C library
 
Greetings,
 
I am trying to acquire analog data from a AI0 and AI1 after a momentary contact closure on PFI0.  (Digital Trigger Rising Edge).  Everything sets up properly, yet the USB-6009 is not triggering when I close the contact.  Here is the code I am using to set it up....
 
 

DAQmxErrChk

(DAQmxCreateTask("AI",&m_hNIAITask));

DAQmxErrChk

(DAQmxCreateAIVoltageChan(m_hNIAITask,"Dev1/ai0: Dev1/ai1","AIInput",DAQmx_Val_Cfg_Default,f64Min,f64Max,DAQmx_Val_Volts,NULL));

DAQmxErrChk

(DAQmxCfgSampClkTiming(m_hNIAITask,"",(float64)m_dwBaseSampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,m_dwBaseSampleRate / 10));

DAQmxErrChk

(DAQmxGetTaskAttribute(m_hNIAITask,DAQmx_Task_NumChans,&uiNumChannels));

DAQmxErrChk

(DAQmxCfgDigEdgeStartTrig(m_hNIAITask, "/Dev1/PFI0", DAQmx_Val_Rising));

DAQmxErrChk

(DAQmxStartTask(m_hNIAITask));

DAQmxErrChk

(DAQmxSetReadAttribute(m_hNIAITask, DAQmx_Read_RelativeTo, DAQmx_Val_CurrReadPos));

while (bContinue) {

DAQmxErrChk

(DAQmxGetReadAttribute(m_hNIAITask, DAQmx_Read_AvailSampPerChan, &iRead, 0));

if (iRead > 0) {

DAQmxErrChk

(DAQmxReadAnalogF64(m_hNIAITask,-1,10.0,DAQmx_Val_GroupByScanNumber,(float64*)pf64WriteIdx/*pdWriteIdx*/,uiArraySampleSize,&iSamplesRead,NULL));

//...Rest of code removed for brevity

}

}



Message Edited by dthess on 01-04-2008 02:56 PM

Message Edited by dthess on 01-04-2008 02:57 PM
0 Kudos
Message 1 of 7
(7,309 Views)
Hello dthess,

The first thing that comes to mind when reading your post is that your digital trigger may not be within TTL specifications.  The trigger is looking for a TTL specification rising edge and a lot of times, closing a contact will not provide the necessary rise time, etc.  The way we would usually do this kind of triggering is with analog level triggering, however the 6009 does not have this functionality.

The only way that I can think of to accomplish what you are trying to do with the hardware you have is to do the trigger in software.  You would have to acquire continuously and then look at your trigger value to determine whether to keep the acquired data (or something similar).   This is not as accurate as hardware triggering, but it should work with your hardware.

If your trigger signal is within the spec,  post back here and we can troubleshoot some other possibilities.
Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 2 of 7
(7,279 Views)

Neal,

Thanks for the response.  Unfortunately we are still having a problem triggering the 6009 using the PFI0 input.

At first we tried hooking the 2.5V and 5.0V outputs on the 6009 to a momentary contact switch, then returning this to PFI0.   We checked the output of the 2.5 and 5V outputs and they appear nominal.  Even with the contact switch held down, the 6009 refuses to trigger the data collection.

Thanks for any input,

Don Hess

 



Message Edited by dthess on 04-09-2008 11:02 AM

Message Edited by dthess on 04-09-2008 11:02 AM
0 Kudos
Message 3 of 7
(7,169 Views)
Hi again Don,

I would like to re-iterate my comment about being sure you are within TTL specification for your trigger signal.  I am pretty sure that you are not using a TTL signal because in the link I provided, it says that for input Low you need a voltage <0.8V.  Your 2.5 is still being read as a high and therefore the device is not registering it as a trigger edge.

Again, the part of the signal that most of our hardware looks at is the rising edge of the signal.  This would explain why when you say "Even with the contact switch held down, the 6009 refuses to trigger the data collection."

You must go from a TTL Low to a TTL high within the correct rise time.  Please look at the link I have provided in my first post and make absolutely sure that your signal is within these specifications.  I have a strong feeling that this is what is causing your issue.
Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 4 of 7
(7,134 Views)

My appologies for not stating this clearer.

I tested with both a 2.5V and 5V source.  My signal is well within the TTL spec. I tested 0->5.0V by DIRECTLY shorting pin 31 (+5V) and pin 29 (PFI0) directly on the USB6009.  It just refuses to trigger.



http://i52.photobucket.com/albums/g20/digital_griffin/USB6009WiringDiagram.png

Thank you,

Don Hess



Message Edited by dthess on 04-10-2008 11:59 AM
0 Kudos
Message 5 of 7
(7,131 Views)

HI again Don,

Thank you for the clarification.  I notice that you do not have a pulldown resistor to sink current on your digital line.  This is necessary because the USB-6009 has an internal pull-up resistor on its digital lines. 

In the USB-6008/6009 User Guide and Specifications, there is a figure that shows various ways to connect signals to the digital line (Figure 14).  I believe method 4 will work for what you are trying to accomplish. Give this a try and see if that helps.



Message Edited by Neal M on 04-11-2008 12:17 PM

Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 6 of 7
(7,091 Views)

Thanks a lot Neal

The reference guide and a voltmeter led me to the problem.  The PFI0 is a +5V source itself.  Hooking it to GND with a resistor (to limit current) did the magic trick.

 

0 Kudos
Message 7 of 7
(7,083 Views)