12-19-2011 06:29 AM
In document DAQ M Series
M Series User Manual
NI 622x, NI 625x, and NI 628x Devices
M Series User Manual
July 2008
371022K-01
is written on page 7-30:
Default Counter/Timer Pinouts
By default, NI-DAQmx routes the counter/timer inputs and outputs to the PFI pins, shown in Table 7-4.
Table 7-4. 68-Pin Device Default NI-DAQmx Counter/Timer Pins
Counter/Timer Signal Default Connector 0 Pin Number (Name)
CTR 0 OUT 2 (PFI 12)
You can use these defaults or select other sources and destinations for the
counter/timer signals in NI-DAQmx. Refer to Connecting Counter Signals
in the NI-DAQmx Help or the LabVIEW Help in version 8.0 or later for
more information about how to connect your signals for common counter
measurements and generations.
I could not find any hint to the appropriate DAQmx command in the "NI-DAQmx C Reference Help" to select other destinations for the counter/timer signals in NI-DAQmx.
Please can you tell me the right DAQmx command ? Thank you very much.
I use the device NI USB-6259 M Series DAQ Device, BNC Term.
Solved! Go to Solution.
12-20-2011 09:27 AM
Hi,
I am not sure if I got your problem correctly, but I suppose you want to do a Counter Measurement using PFIx as a trigger, where x stands for the number of the PFI Input.
After looking into the routing table, for the PCI- 6259, I saw, that theres a direct connection between the PFI channels as a source and the counter channel as a destination. If his is, what you want to do, I could do an IO trace of the DAQmx commands.
Also have you had a look at the examples for programming DAQmx with C?
The command for connecting two channels is:
DAQConnectTerminals ("/Master/PFI8", "/Master/PFI0", "InvertPolarityNo", "")
Where Master is the Name of my Card.
But as I said: the connections can only be routed manually for the routes that are marked with a yellow square.
Could you please specifiy your problem further, so I can have a better look at it. What is it, you want to do?
12-20-2011 10:28 AM
An even better way to do counter output signal routing is using the DAQmxExportSignal function. The reason is the route is bound to a particular task. If you use DAQmxConnectTerms, the route you set is active until you explicitly do a DAQmxDisconnectTerms for that route or reset the device. This is even the case if you run a completely different piece of DAQ code. By using DAQmxExportSignals, once the task is destroyed, the route from the output to the PFI is also removed. Below is the function definition. You can also find this in the NI-DAQmx C Reference Help.
int32 DAQmxExportSignal (TaskHandle taskHandle, int32 signalID, const char outputTerminal[]);
Routes a control signal to the specified terminal. The output terminal can reside on the device that generates the control signal or on a different device. Use this function to share clocks and triggers between multiple tasks and devices. The routes created by this function are task-based routes.
Input | |||||||||||||||||||||||||||||||||||||||||
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
taskHandle | TaskHandle | The task used in this function. | |||||||||||||||||||||||||||||||||||||||
signalID | int32 | The name of the trigger, clock, or event to export.
|
|||||||||||||||||||||||||||||||||||||||
outputTerminal | const char [] | The destination terminal of the exported signal. You can specify a string containing a comma-delimited list of terminal names. |
Name | Type | Description |
---|---|---|
status | int32 | The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error. |
12-23-2011 03:27 AM
Hello Steven and Peter ,
thanks for your answers. However they did not yet solve my problem. I only want to release PFI 12 and use it as a normal digital output instead of having the clock of CTR 0 driving PFI 12. I don't want to see that clock at all.
In my code I use ctr0 to internally clock a digital input bus. Now I inserted the following code as proposed by Steven:
DAQmxErrChk( DAQmxExportSignal ( _taskHandleCounterInput,
DAQmx_Val_CounterOutputEvent , "/Dev1/PFI7" ) );
Now /Dev1/PFI7 also drives the clock, together with PFI 12.
For the command DAQmxDisconnectTerms is written:
int32 DAQmxDisconnectTerms (const char sourceTerminal[], const char destinationTerminal[]);
Purpose
Removes signal routes previously created using DAQmxConnectTerms. DAQmxDisconnectTerms cannot remove task-based routes, such as those created through timing and triggering configuration.
However I don't have previously used DAQmxConnectTerms.
With which DAQmx command can I release PFI 12 and use it as a normal digital output instead of having the clock of CTR 0 driving PFI 12 ?
Thanks and kind regards
datafriend
12-29-2011 10:50 AM - edited 12-29-2011 10:53 AM
datafriend,
If I remember correctly, you can 'free' the default counter output terminal by calling DAQmxSetCOPulseTerm and passing an empty string in for 'data'.
Hope that helps,
Dan
Edit: You can also set this to any other valid terminal (ie... "Dev1/PFI0") and send the output there.
01-05-2012 01:52 AM
Did this resolve the issue?
Please let me know if you need further assistance.
01-05-2012 05:19 AM
Hello Dan and Peter,
thank you very much. Dan's proposal solved my problem:
With DAQmxSetCOPulseTerm PFI 12 will be freed and can be used as a normal digital output instead of having the clock of CTR 0 driving PFI 12:
DAQmxSetCOPulseTerm( _taskHandleCounterInput, "Dev1/ctr0", "" );
Thanks and kind regards
datafriend