Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1250

How to specfy the terminal of USB 6210 with python ?

$
0
0

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


Viewing all articles
Browse latest Browse all 1250

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>