07-07-2011 01:38 PM
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
Solved! Go to Solution.
07-08-2011
02:32 PM
- last edited on
02-13-2025
02:59 PM
by
Content Cleaner
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.
07-08-2011 08:49 PM
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
07-08-2011 10:22 PM
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
07-08-2011 11:12 PM
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
07-11-2011 02:22 PM
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
07-11-2011 04:57 PM
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.
07-11-2011 06:52 PM
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
07-11-2011 09:23 PM
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