08-28-2020 01:39 PM
Hi,
I am using USB-6001 device and I need to know how to select PFI1 instead PFI0 (Default) as counter source in Python.
I know that device is supporting it since I can use PFI1 through NI MAX Test panel
Thanks
Danny
Solved! Go to Solution.
08-31-2020 10:25 PM
Hi, this is the available source for NI DAQmx example program:
https://github.com/ni/nidaqmx-python/tree/master/nidaqmx_examples
And this is the link to refer for the definition of the function:
https://github.com/ni/nidaqmx-python/tree/master/nidaqmx/_task_modules
If you need full guidance on how to control NI DAQ device with Python and NI DAQmx:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Pf1SAE&l=en-MY
09-01-2020 01:56 PM
Thanks for the link, I found the way to do it, there is working code:
import nidaqmx
import nidaqmx.constants
import time
PPS_OUT_NI_INPUT = "/ctr0"
PPS_IN_NI_OUTPUT = {'J3': "/ao0", 'J13': "/ao1"}
PPS_FREQ = 1
PPS_DURATION = 5
input('Connect signal to PFI0 and press enter')
task_input = nidaqmx.Task()
task_input.ci_channels.add_ci_count_edges_chan('Dev3/ctr0', 'tata').ci_count_edges_term = 'PFI0'
task_input.start()
count_start = task_input.read()
time.sleep(2)
count_stop = task_input.read()
count = count_stop - count_start
task_input.stop()
task_input.close()
print('Count on PFI0 is [' + str(count) + ']')
input('Connect signal to PFI1 and press enter')
task_input = nidaqmx.Task()
task_input.ci_channels.add_ci_count_edges_chan('Dev3/ctr0', 'tata').ci_count_edges_term = 'PFI1'
task_input.start()
count_start = task_input.read()
time.sleep(4)
count_stop = task_input.read()
count = count_stop - count_start
task_input.stop()
task_input.close()
print('Count on PFI1 is [' + str(count) + ']')
08-28-2024 05:17 PM
I am testing something similar. I am noticing that if I put a high frequency pulse it has a little trouble counting. Might be off by a few pulses. I wondered if you had seen this too and if you fixed it?