How can one loop over the PFI ports of a device in Python (which we are using for setting triggers/clocks)?
For the ai/ao/di/do we did this with the following format:
deviceName = "Dev1" device = nidaqmx.system.device.Device(deviceName) for di in device.di_lines:
(In our program we are adding it to a list that the user can choose out in the UI).
However, it gives the name only in the format: Dev#/port#/line# and for setting/exporting an external/internal clock it seems the syntax only accepts /Dev#/PFI#.
Therefore my question is:
Can you loop over the PFI ports in Python in a similar way as the example above? Where you would get it in a format similar to Dev#/PFI#?
Thanks in advance
Solved! Go to Solution.
I don't know anything about the python API into DAQmx, but I *can* report that the LabVIEW API has "Device property node" that allows one to specify a device by name and then query for an array containing all the terminal names.
Hopefully that means that a similar capability is available from python, I just don't have any particular ideas about how to access it.
(FWIW, in LabVIEW, the same Device property node can be used to query for an array of all the DI lines. Perhaps that means that the python method for terminals will look like the python method for DI lines?)
It helped, I was aware that you could acces the terminal but I did not know this was the place where these ports are "accessed". Also the syntax is slightly different, which is why I did not find them in the first place. However, for people having the same problem, I believe the following should work:
device = nidaqmx.system.device.Device("Dev#")
for tr in device.terminals: print(tr)
No need to use tr.name here as this will only result an in empty string.
Thanks again for the input!