Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6001 - How to select PFI1 as counter source

Solved!
Go to solution

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

 

Message 1 of 4
(1,907 Views)

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

0 Kudos
Message 2 of 4
(1,853 Views)
Solution
Accepted by topic author ynnadetoc

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) + ']')

Message 3 of 4
(1,838 Views)

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?

0 Kudos
Message 4 of 4
(362 Views)