05-09-2006 01:57 AM
05-09-2006 05:11 PM
02-01-2007 11:59 AM
02-02-2007 10:00 AM
Hello Sandia,
First, follow the directions above to make sure the terminals are available for routing. You can see in the above image, that for the device shown, PFI15 can be directly routed to Ctr0Source. After confirming that your device also supports this routing, you can use the following function to connect terminals in CVI.
You will find the following information in the DAQmx C Reference Help.
int32 DAQmxConnectTerms (const char sourceTerminal[], const char destinationTerminal[], int32 signalModifiers);
Simply specify the terminals you would like to connect for the source and destination. Options for the signal modifier include:
DAQmx_Val_DoNotInvertPolarity | (Do not invert the signal). | |
DAQmx_Val_InvertPolarity |
(Invert the signal). |
Alternatively, you can set terminals with property nodes for the channel you set up. For example:
int32 __CFUNC DAQmxSetCIFreqTerm(TaskHandle taskHandle, const char channel[], const char *data);
Hope this helps,
Jennifer O.
Applications Engineer
National Instruments
02-05-2007 06:46 PM
02-06-2007 09:41 PM
02-07-2007 11:31 AM
Just as a final note, this application works now. The essential code lines are:
DAQmxCreateTask("DAQClockFrequency", &taskOut);
DAQmxCreateCIFreqChan(taskOut, "DAQBoard/ctr0", // PFI8 is default Ctr0 Source
"Frequency", 1000000, 3000000, DAQmx_Val_Hz, DAQmx_Val_Rising,
DAQmx_Val_HighFreq2Ctr, 0.001, 4, "");
// Layout error on circuit board, grounding PFI8. Reroute around error. The alternate function,
// DAQmxConnectTerms ("/DAQBoard/PFI15", "/DAQBoard/Ctr0Source", etc.
// does not seem to work here.
DAQmxSetCIFreqTerm(taskOut,"", "/DAQBoard/PFI15"); // the initial '/' was required
DAQmxCfgImplicitTiming(taskOut, DAQmx_Val_FiniteSamps, NUM_SAMPLES);
The measurement task is started and samples taken in a separate function call. The only issue here is that the initial sample is incorrect. The value of NUM_SAMPLES is 200, so I just set the Sample zero value to equal the Sample one value.
02-08-2007 02:45 PM
Thanks Sandia for sharing your solution.
I thought for completeness I would add an explanation regarding the initial frequency measurement. Frequency measurement works by counting the number of unknown pulses that occur during a known time period or by counting the number of pulses of a known frequency which occur during the unknown period. This determines the period of the signal and the frequency can be calculated as f=1/T.
For the very first measurement, the counter will begin counting the pulses on the source and it is unlikely that this is starting exactly at the beginning of the gate pulse and therefore the first reading will be inaccurate (too few samples will be read). The same applies to period measurement. This is expected behavior and is outlined well in the following knowledgebase: When Performing Buffered Period Measurement, Why Is the First Value in the Buffer Incorrect? .
Regards,
Jennifer O.
06-12-2008 06:59 AM
06-13-2008 06:07 PM