Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to check if NI USB 6251 is active programatically

Solved!
Go to solution

I am doing an automated capture of a series of signals through the 6251, I need to programatically check if device is really active and then communicate to some other device to send the signal.

Currently there seems to be a delay after I call BeginReadMultiSample and it is not consistent so I can't just add an approximate delay.

So some of emitted signals are not captured at all since the NI USB 6251 had not become active even after I called BeginReadMultiSample. is there any way I can poll for the device status through program. (I am using C# with NationalInstruments.DAQmx.dll)

 

Thanks in advance

0 Kudos
Message 1 of 5
(3,597 Views)

Hi Raghu,

 

Please provide the following details:

 

How much delay are you getting (in ms, us?) or how many samples are getting missed and at what sampling rate?

How are you comparing the signal at the time you are giving the BeginReadMultiple command and with the acquired signal i.e. how are you making sure that the signal you are expecting indeed started after you gave the read command and not before it? Are you using some kind of triggering for that or something?

 

Regards,

Ujjval Shah

0 Kudos
Message 2 of 5
(3,559 Views)

Ujjwal,

 

The delay is inconsistent and they is no definite way of reproducing it. (It may be OS dependent also, i m using XP). My sampling rate is 1MS\s.

 

Here is what i do 

1) I initailize my signal captures by calling  "BeginReadMultiSample" command.

2) After which i call my own serial function which is connected to a hardware through serial channel to emit the signal to be captured.

3) the signal is stored in a file using "AnalogInCallback" (using my own custom format which is of no consequence right now).

 

here is the Problem:

 

Sometimes  even after i have executed "BeginReadMultiSample"the USB device has not yet reached the ready state (This may be because the OS was busy with something else and driver was unable to process the command). I which case my serial function executes assuming that device was ready and the signal is lost.

 

So is there any way i can poll to device to check its readiness before i call my serial function to emit the signal??

 

Right now this happens to about 100 per 5000 signals.

 

 

Thanx

Raghu

0 Kudos
Message 3 of 5
(3,555 Views)
Solution
Accepted by topic author Raghu01

Hi Raghu,

 

 Is it ok for you if your data acquisition starts before the actual signal? If yes then what i suggest is after giving BeginReadMultiSample command generate some dummy signal at any free DIO/AO channel and acquire it to some other AI channel. Wait for this signal to be acquired before you send the actual trigger to your signal generating device.

 

It is not the best solution but will serve your purpose if you are fine with the additional few samples in the beginning.

 

Hope this helps.

 

Regards,

Ujjval
0 Kudos
Message 4 of 5
(3,543 Views)

I was this project for some time. But your solution worked but only waited for for the first buffer read in the callback!!

 

Thanks Ujjwal

0 Kudos
Message 5 of 5
(3,376 Views)