LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Change value of counter input terminal

I have a PCI-6229, and I would like to use PFI0 as the default  input terminal used for counter measurement.

Currently, my code is:

 

DAQmxErrChk(DAQmxCreateCICountEdgesChan(taskOut, "Dev4/ctr0",

"CountEdges", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp));        

 

And I would basically like to have "Dev4/ctr0" refer to PFI0 instead of PFI8 which is its default value.

Is there any function that could do that?

0 Kudos
Message 1 of 4
(3,239 Views)

Not sure if this can apply to your actual board, but this knowledgebase entry can be of some help.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,236 Views)

Thanks for the link. I followed the instructions:

  • Select Channel Creation/ConfigurationDouble click DAQmxSetChanAttribute
  • In the Attribute field click the (...) button
  • Select the Channel Attribute Constant (as shown in picture below)
  • Click OK
  • Configure the parameters as you need.

The attribute constant I am interested is Input Terminal, which is in the subcategory Counter Input->Count Edges.

However, when I select Input Terminal, all the fields (Task Handle, Channel, Value, Buffer Size and Status) are blank, whereas the value should be PFI8. If I click on Value (which is what I would like to change), I get the error message:

 

No set of value constants has been defined for this attribute.  The following is the help text for the attribute:
Constant:  DAQmx_CI_CountEdges_Term
Data Type:  string (char *)
Description:  Specifies the input terminal of the signal to measure.

 

I double-checked and even if I use DAQmxGetChanAttribute instead of DAQmxSetChanAttribute, all the fields are blank as well.

0 Kudos
Message 3 of 4
(3,230 Views)

Hello Krigi,

I went a little bit in more detail on this subject and these are the informations I can share with you.

 

First of all, which application and terminal are you using? Counter inputs are assigned by default to some of the I/O terminals on the connector: it is possible that in your actual application the connection you require is already in place. Please note also that "Dev4/Ctrl0" is the name of the counter itself, not the name of one of its input. Depending on the type of measurement, the counter uses different terminals.

 

To discover which terminals are assigned by default to counters open MAX and right-click on your device into the tree on the left, next choose "Device Pinouts" function and see the informations shown: on my PCI-6221, which is of the very same family of your actual board, Ctr0Source is already assigned to PFI0, so if you are for example running a edge counting measurement you do not need to perform any further assignment.

 

To understand which terminal is used for various counter measurements you can look at DAQmx help and search for "Counter parts in NI-DAQmx": this page shows all counter terminals and explains how each one of them is used.

 

Going one step further, you can use MAX to see if the route you want to perform is available: see How Can I Know What Internal Routes are Available on My Device? KnowledgeBase entry for details on this subject. Also, you can create a task in MAX for your measurement and see which terminal it uses.

 

Finally, you may use DAQmxConnectTerms to specify your route if you need to do it (please note the hint given in this document)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(3,221 Views)