labscript-suite / labscript-devices

A modular and extensible plugin architecture to control experiment hardware using the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦.
http://labscriptsuite.org
Other
5 stars 58 forks source link

Add support for differential analog inputs in NI_DAQmx #75

Closed dihm closed 2 years ago

dihm commented 3 years ago

This addresses #62.

Basically, it modifies NI_DAQmx to allow for all of the analog inputs to have either single-ended termination or differential termination. It also modifies get_capabilities.py so that support for the terminations can be introspected correctly and defaults determined (since apparently simultaneous sampling devices do not support single-ended inputs).

I've gone ahead and also uploaded an example of what the changes produce in the form of a class for a NI USB 6366. Assuming simulated devices will correctly introspect most, if not all, of the parameters, I can go ahead and update all of the other devices to match the new settings once everything else is deemed OK.

I've lightly tested with a physical USB 6366, but still would like to confirm testing with a more standard device before merging.

dihm commented 3 years ago

By fortuitous circumstance, another labscript user has another specialized DAQ device that is restricted to yet another kind of AI termination (Pseudo-Differential). Since I was already mucking around with this, I went ahead and incorporated functionality to use it as well.

In so doing, it turns out his special device exhibits yet another edge case in determining the AI_start_delay that I've had to work around (and represents the bulk of the work). I've confirmed that these new additions don't break my test USB 6366, but I'll have to leave it to Andrew to test if they actually get his device up and running.

dihm commented 2 years ago

More as a note to myself:

dihm commented 2 years ago

Note that 48d29f0 fixes a pretty serious bug I accidentally introduced merging #70 that completely breaks the get_capabilities.py script. Good thing no one has used that in the past many months I guess...

dihm commented 2 years ago

I've tested this in lab on a system using a USB-6343 without issue. Also checked that the warnings work and don't cause failures if someone updates their labscript-devices without updating model specifications or recompiling the connection table.

Going to go ahead and merge.