07-11-2020 02:01 AM
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.
please help me if you have solution.
best regards
Solved! Go to Solution.
07-11-2020 08:36 AM
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
07-12-2020 08:10 AM
Thank you for the information.
we can proceed our development by your information.