From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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 3
(1,319 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 3
(1,265 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 3
(1,250 Views)