Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically disable DAQ output at shutdown

Is it possible to ensure that my NI DAQ card disables all output prior to shutting down? I am aware of the danger of random impulses at startup and shutdown, and normal operating procedure is to turn off power prior to shutdown. However, today I forgot, and lo and behold during a reboot cycle our device (controlled by our DAQ card) ran up against one of it's mechanical stops with significant force.

Is there a way to turn off or disable output from an NI 6259 from either a C program or a shell script? The idea being that this procedure could be called automatically at shutdown prior to other services?

Is this perhaps not possible after the OS driver looses control of the system?

Thanks for your time & advice!

0 Kudos
Message 1 of 7
(4,954 Views)

Hi dsf900-

One idea would be to create a "C" program that executes a DAQmx Device Reset on any devices you want to set to a known state.  Then execute that as part of your shutdown sequence.

For your M Series device, this would most likely mean setting AO channels to calibrated zeros, adjusting DIO lines to the programmable power up states, and disabling AI and counter operations.  You would want to thoroughly test and qualify the behavior before you relied on it, but that seems like the most fail-safe to me.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 2 of 7
(3,977 Views)

Thanks for your suggestion Tom. I'm not sure this really does what I need it to, however. Our current setup is designed to zero all outputs when not in use. Even if all outputs have been zeroed programatically (from the C API), these same outputs can produce unpredictable values at startup and shutdown.

I was thinking, and I'm not even sure this *COULD* be done, because who knows what the BIOS is going to do before the OS and driver are loaded, or after the driver looses control? I'm half wondering if it's possible to get a power supply controllable from our PC, so that we could just cut the power entirely (programatically) during the shutdown cycle.

0 Kudos
Message 3 of 7
(3,977 Views)

Hi dsf900-

I misunderstood the issue.  I was thinking that the output lines were "sticking" because your application exited and the lines were left in non-safe states.  Instead, the lines are going to unpredictable states because explicit control of the device goes away as your application and/or the DAQ drivers do.  That is a tougher problem to mitigate.

In that case, I'd probably find a way to electrically isolate your device from the DAQ device.  Maybe you could insert mechanical relays or something else between the outputs of the DAQ device and your DUT, so that you can unconditionally remove the connections between the two before starting shutdown.  Unfortunately that suggestion is a bit more heavy-handed than a software-only approach, but it also seems like it leaves little room for error.

Tom W
National Instruments
0 Kudos
Message 4 of 7
(3,977 Views)

Yes, I'm thinking that might be the way to go. Do you happen to be familiar with any devices like this (ideally that wouldn't require the DAQ card itself)? Something like a relay on a PCI card?

A little googling shows lots of devices like this, but it seems like they start at $300 and go up from there (they have 8-16 or more relays and are designed for high power). The motor we use has a 5v "enable" circuit that we have used to wire our E-stop. If we could find a cheap-ish suitable low-power relay we could just include that in the E-stop circuit.

Thanks again for your input!

0 Kudos
Message 5 of 7
(3,977 Views)

HI dsf900-

You caught me talking about hypothetical solutions that I didn't have a practical implementation in mind for.

NI has a lot of solutions for things like this.  You could use a cDAQ-9171 and an appropriate C Series module for a USB-based solution.  You could also consider one of the NI switch/relay modules.

Since you mentioned cost being important, I just googled "usb relay" and came up with this.  I can't vouch for its quality or usability because I haven't actually used one, but at that price it might be worth getting one to try out.  I'm sure there are many similar solutions out there, depending on what kind of environmental specs, channel/line count, etc, that you need.

Hopefully this helps-

Tom

Tom W
National Instruments
Message 6 of 7
(3,977 Views)

Thanks for all your ideas! I guarantee you that you're better at this than I.

I just found out that we have some grant money that expires in a short while, so the NI relay modules might work out perfectly, and work into some other research we have going on at the same time. Great suggestions all around.

0 Kudos
Message 7 of 7
(3,977 Views)