Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffered lengthy data collection using PXI-6551

Solved!
Go to solution

Hi All,

 

I'd like to attempt the following (or similar).

 

1. Setup a script for the PXI-6551 that runs continuously (or a large finite number of times).

2. During each run, the script executes a finite number of SPI or I2C data reads.

3. The data are stored in one onboard buffer and quickly grabbed by software so there are no collisions or data overruns.

4. The software is able to close the task when a suitably sized (huge) array is filled.

 

Is this possible?  Does the multi-record acquisition function for PXI-6551.

 

Please advise ASAP.

 

Thanks.

 

Anand

0 Kudos
Message 1 of 9
(4,940 Views)

Hi Anand,

 

Thank you for posting.  It should be possible to create the application you described using a PXI-6551, though it could prove to be a bit difficult.  One possibility would be to try using the SPI Digital Waveform Reference Library or the I2C Digital Waveform Reference Library for your application.  Otherwise, you would have to create custom SPI or I2C read commands.  The PXI-6551 does support multi-record acquisition, so there should be no problem there.

 

The 655x series will have trouble with the recognition and response of the acknowledge bit.  The article recommends using an FPGA card to do it.  Alternatively, you could consider the USB-8451, which is a device that deals specifically with the SPI/I2C interface.  A tutorial about using it can be found here. Hope this helps!

 

Regards,

Joe S.

0 Kudos
Message 2 of 9
(4,924 Views)

Hi Joe,

 

Thanks for your reply.  I already have bit banging code for I2C/SPI communication. 

 

I'm planning on running scripts with my vectors and using marker triggers to initiate multi-record acquisitions.  This should hopefully speed up waveform download time to the card.  There is no saving in memory since memory from unused channels does not get appropriated to the active ones.  Is that correct?

 

Thanks.

 

Anand

0 Kudos
Message 3 of 9
(4,915 Views)

Hi Joe,

 

I am unable to locate the FetchMultiRecordU32 in the drop down list once my acquisition task is enabled.  Either this is not supported for the PXI-6551 or I have an older version of the driver.  Please advise.

 

By generating the waveform multiple times, I am able to get around previous latency issues.  But currently cannot acquire multiple records.  What can be done?

 

Thanks.

 

Anand

0 Kudos
Message 4 of 9
(4,913 Views)

Hi All,

 

The problem might have to do with an incomplete niHSDIO.cs class module.  This did not have a reference to the

FetchMultiRecordU32 or any of the multirecord acquisition function calls.

 

So I added the following

 

            [DllImport("niHSDIO.dll", EntryPoint="niHSDIO_FetchMultiRecordU32",CallingConvention=CallingConvention.StdCall)]
            public static extern int FetchMultiRecordU32(System.IntPtr Instrument_Handle, int Samples_To_Read, int Max_Time_Milliseconds, int Starting_Record, int numberOfRecords, [In, Out] System.UInt32[] Data, [In, Out] System.UInt32[] Dummy);

But C# still does not recognize this function.  Obviously I am doing something wrong.  What is the C# equivalent of the folowing C function?  Mainly what does niHSDIO_wfminfo wfminfo[] correspond to in C#?

 

ViStatus = niHSDIO_FetchMultiRecordU32 ( ViSession vi, ViInt32 samplesToRead, ViInt32 maxTimeMilliseconds, ViInt32 startingRecord, ViInt32 numberOfRecords, ViUInt32 data[], niHSDIO_wfmInfo wfmInfo[]);

 

Thanks a million. 

 

Anand

0 Kudos
Message 5 of 9
(4,911 Views)

Hi All,

 

I've been mistakenly using an older version of the niHSDIO.cs class in which the multirecord functions (and others) had not been defined.  The latest niHSDIO.cs class from National Instruments does have the latest function definitions as well as a definition for the niHSDIO_wfminfo class.

 

Anand

0 Kudos
Message 6 of 9
(4,887 Views)

Hi Anand,

 

The 6551 has a specific amount of memory available to the acquisition engine and the generation engine and they are separate from each other.  Each set of memory is available to all channels on each engine.  Other than that, it sounds like you are on the right track with the newer version of the driver.  Hope this helps!

 

Regards,

Joe S. 

0 Kudos
Message 7 of 9
(4,871 Views)

Thanks Jon,

 

However, not much luck with the new class NIHSDIO.cs.  My basic problem is that the FetchMultiRecordU32 function call spaces samples differently than anticipated thereby messing up the bit patterns.  Would you be able to point me to a DOTNET example created and tested by National Instruments using this function call?

 

My current status is as follows:

1.  Set up a generation task that repeats n times.

2.  A data active event is exported at the beginning of the generation session (not each time the task repeats).

3.  A multi-record acquisition is initiated using the data active event.

 

I notice some anomalies in the C# version of the FetchMultiRecordU32 function.  While the C function requires one to pass a pointer to the niHSDIO_wfminfo array, the C# function only receives the struct itself.

 

Please advise.  I do have email and phone support from NI so let me know if that is the best way to get my project back on track.

 

Thanks.

 

Anand

0 Kudos
Message 8 of 9
(4,865 Views)
Solution
Accepted by topic author ajog

Hi All,

 

It appears that I don't have a reliable advance trigger to ensure the multi-record acquisition task functions reliably.  In my generation repeat task, a data active event (rising edge) is exported just once which initiates acquisition.

 

I have hence recast the acquisition task as a single (albeit huge) record acquisition task with success. 

 

My main goal was to reduce the time it takes to download large waveforms to the 6551 which has been accomplished by repeatedly generating the same waveform.

 

Thanks to Jon from National Instruments who stuck around to assist.

 

Anand

0 Kudos
Message 9 of 9
(4,862 Views)