Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Does nidaqmxbase automatically reset a device if a controlling program crashes?

My application does a number of i/o functions which drive mechanical hardware. One function, for example, starts an counter clk which generates clock pulses that are routed to a monostable which keeps some hardware engaged. I can stop clock when the app closes normally, but if teh app crashes for whatever reason, the board just keeps going like a train. For safety reasons, I'd really want the board to auto reset when it loses connection with the app. Does the nidaqmxbase hardware dirver have a  close routine thats entered when a device is closed in an app? The reset could be implemented there. Is there a way to implement this safety feature?
0 Kudos
Message 1 of 7
(3,456 Views)

Hi,

Unfortunately I do not believe this is possible to do automatically given an application crash.  It can be done programmatically but obviously once your program has crashed its too late!  This can be done by manually reseting the device.  How to do this depends on the platform you are on.  What is your environment?  e.g. OS and language


Regards,

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 2 of 7
(3,443 Views)

Hi,

 

OS is redhat linux and I'm writing regular C.

 

I would have thought when the prog crashes, all  the NI threads would diasappear which must close open fd's to the device? This should cause the OS to enter a close part of the driver?

 

I'm getting around it in a messy way by having a high priority "minder prog" which monitors a heartbeat in a shared memory segment. If it looses this, it does a reset on the board.

 

Only way I could get this to work was to create a task on the device, define an operation to it but NOT start it. Anything less seemed to prevent the board reset from working?

 

Have you got any better ideas?

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

Hi,

 

As far as I am aware the driver does not work in this way but I shall double check this fact as I am not certain.  Given this it sounds like you have found a suitable if not ideal work around.  Although you mention about making a task for the card.  Does the reset not work without this?


Regards,

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 4 of 7
(3,421 Views)

Hi,

 

No, it appeared that unless a task had been defined and loaded with something, the reset did nothing.

 

Maybe the code thinks "well, if I've got nothing on the go, why should I have to reset?"

 

On another issue, I am using the DAC 6713. At the moment I'm driving in "on demand" mode, but would prefer to drive it in clocked mode as I think it will run faster ( I'm trying to get 1Khz).

I only want to write 1 value for each channel (8 values in total) at a time. So what I really want is to be able to specify the FIFO size to be 8 and for the system to block when I write new data (I will always be early), and wait until the last 8 values have been clocked out and then take my new data and release my code.

 

Is this possible?

 

cheers
0 Kudos
Message 5 of 7
(3,414 Views)

Hi IvoryStag,

 

Certainly if you want to get a reliable 1k rate you will need to use clocked mode however the buffer size you set is samples per channel and it won't allow a value as one as it requires a buffer of size 2 or more.  To get the consistent rate and ensure you don't get buffer underflow errors you would be much better writing to the buffer in larger chunks anyway, would this work with your application?

 

Regarding on waiting for those values to be clocked out unfortunately there is no function in DAQmx Base for doing this.


Regards,

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 6 of 7
(3,389 Views)

Hi,

 

I'm always using more than 1 channel, so I can set 1 sample/chan (lets me do that anyway!)

 

And I'm not too worried about when in the 1ms window the data goes out, as long as it's not late.

 

Also, i cant calculate the next sample to go out/chan till I've got a new sample/chan in from the ADC!

 

So, if there is no way ofgetting the DAC to hold, I'll have to use the device on demand.

 

 However, since I've replaced the digital o/p stream with the onboard clocks, the DAC o/p waveform looks as clean as a whistle. Before, it was all screwed up. Just looked as if the DAQ subroutines were getting overloaded?

 

So, at the moment, I'm happy I'm able to get 1 sample in on 32 channels of ADC and 1 sample out on 8 channels of DAC at 1 Khz.

 

Thanks for all your help

 

cheers
0 Kudos
Message 7 of 7
(3,386 Views)