Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to specfy the terminal of USB 6210 with python ?

Solved!
Go to solution

Dear all,

 

I am learning how to use the nidaq device with python.

we have USB 6210 and python module nidaqmx.

we want to use USB 6210 as counter.

 

i made python code below.
###################################

import nidaqmx

 

counter = nidaqmx.Task()

rate = 100000

co1 = counter.co_channels.add_co_pulse_chan_freq(

           counter = "Dev2/ctr0",

           units = FrequencyUnits.HZ,

           freq = rate)

 

# if terminal is selected, daq is not working.

co1.co_pulse_term = "Dev2/PFI7"

 

counter.start()

 

######################################

 

when terminal is not selected, counter is output from PFI4.

 

please help me if you know how to select.

 

actually, i made program for checking the bhavior this problem.

 

###################################

import nidaqmx

 

counter = nidaqmx.Task()

rate = 100000

co1 = counter.co_channels.add_co_pulse_chan_freq(

           counter = "Dev2/ctr0",

           units = FrequencyUnits.HZ,

           freq = rate)

 

counter.start()

 

with nidaqmx.Task() as counter1:

      rate = 50000

      co1 = counter1.co_channels.add_co_pulse_chan_freq(

      counter = "Dev2/ctr0",

      freq = rate)

      co1.co_pulse_term = "Dev2/PFI7"

      

      counter1.start()

      h = input("ok ? >>")

######################################

In this case, i can select terminal in next task.

if i write terminal in frist task, error is shown.

 

"DaqError: Destination terminal to be routed could not be found on the device.
Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer or your hardware documentation for valid terminal names.
Property: DAQmx_CO_Pulse_Term
Destination Device: Dev2
Destination Terminal: Dev2/PFI7
Channel Name: Dev2/ctr0
Task Name: _unnamedTask<4E>"
 
i have any strange things,
for exsample, can not specify terminal at PFI2 as using counter input with task.timming.

 

please help me if you have solution.


best regards

0 Kudos
Message 1 of 3
(2,162 Views)
Solution
Accepted by topic author kai-chan

Under DAQmx, terminal names require a leading '/' character, channel designations don't.  I've never really understood why things were done this way, but that's where the problem is.

 

Legal terminal: "/Dev2/PFI7"

Legal channel: "Dev2/ctr0"

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 3
(2,135 Views)

Thank you for the information.
we can proceed our development by your information.

0 Kudos
Message 3 of 3
(2,098 Views)