08-05-2019 04:17 AM
I'm adding a USB-6216 to some existing control software that uses knowledge of the hardware output state to control output sweeps (basically designed to ensure the instrument doesn't unintentionally run outside of voltage bounds and blow up an essentially irreplaceable sample). Is there a way to read from the USB-6216 what the voltage it is supplying to a given ao channel is? I have tried this using something like:
with nmx.Task() as task:
task.ao_channels.add_ao_voltage_chan(self.port)
outputLevel = task.read(number_of_samples_per_channel=1)
But it tells me you cannot read from this type of input. You can usually do it in LabView? Either directly or as an 'internal channel' feeding back the information.
Does anyone know how this can be done with python nidaqmx?
Thanks.
Solved! Go to Solution.
08-05-2019 09:37 PM
As an add-on to this, I've worked out how to make it work in labview. Code is:
So my issue now is only how I implement in python. I guess this boils down to two questions:
1. How do I do the equivalent of entering I/O filtering settings and switching internal channels on, which I can do in Labview with a right click menu and check-box.
2. Probably the easy bit, how to read the internal channel (I suspect usual analog input read on _ao0_vs_aognd).
Will post details if I manage to solve...
/A
08-06-2019 12:17 AM
I think I'll close this off solo. 1. wasn't an issue. Code for 2. is:
Tested for retained function after a reboot (without running labview to set anything re: I/O Filtering) so I suspect this solution works 'out of the box' as a way to direct read output.
/A