Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: May 22, 2008


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

NI-SCOPE Stream to Disk Using Win32 File IO

0 ratings | 0.00 out of 5
Print

Overview

The basic and advanced examples below demonstrate using continuous acquisition to fetch a user-defined, but quite large record of data all while continuously streaming the data to a binary file using the Win32 File I/O VIs. The digitizer is configured using the Configure Vertical and Configure Horizontal VI's. Auto setup in this case may not be useful, as it may choose a horizontal rate that exceeds the computer's streaming capabilities.

Benchmarks with the recommended hardware below have been at 110MB/s of data streaming to disk.

In these examples, continuous acquisition is used. This allows the user to start the digitizer, and continuously fetch data without losing any points. This is accomplished by configuring a software trigger and never sending the software trigger. Therefore, the digitizer will continuously acquire data into its onboard memory until Abort or Close is called.

The producer loop continuously fetches data from onboard memory into the LabVIEW memory using DMA transfers. This data is placed into a queue in order to efficiently transfer the data to a parallel consumer loop where it is written to file. If the sampling rate is low, the computer can fetch all the data from the digitizer, so data is never overwritten. However, at faster sampling rates, the computer will not be able to fetch the data before it is overwritten by new data. This results in the "data overwritten" error.

The consumer loop continuously empties data from the queue and writes data to disk using the LabVIEW primitive Write to Binary File.vi. The file is opened using the Win32 Open File.vi, which disables Windows caching during the write process, resulting in increased performance. However when Windows caching is disabled, data must be written to file in a multiple of the sector size of the disk (typically 512 bytes).

NOTE: If your digitizer has the 8MB/Ch memory option, you will need to reduce the 'Samples Per Fetch' from 4194304 to a sample size which uses less than 8MB. (1/2) * (4194304) = 2097152 works well. Please keep in mind, the 'Samples Per Fetch' has to be a multiple of the disk sector size (typically 512).

Downloads

Filename: ni-scope-streaming-basic8.0.zip
Requirements: View

Filename: ni-scope-streaming-advanced.zip

NI Recommended Hardware:

Digitizer:

  • NI 5105
  • NI 5112
  • NI 5114
  • NI 5122
  • NI 5124
  • NI 5142
  • NI 5152
  • NI 5922

    Additional Hardware:
  • PXI 8105/8106 controller
  • Addonics eSATA 4-drive RAID (ST5X1PM-4)
  • ExpressCard34 to eSATA Adapter (ADEXC34R5-2E)

    OR
  • PXIe 8105/8106/8130 controller
  • NI HDD-8263 4-drive RAID or NI HDD-8264 12-drive RAID
  • NI 8262 for PXI Express (provides link to RAID enclosure)


Software:

  • NI-SCOPE 3.3 or later
  • LabVIEW 8.0 or above

Recommended Input Signal: 10 Hz, 1.8 Vpp, sine wave

Included in this EPD are:

(Basic Version)

  • niScope Stream to Disk Queues Win32 File IO_Basic.vi
  • supporting files for Win32 File IO VI's

(Advanced Version)

  • niScope Stream to Disk Queues Win32 File IO.vi
  • niScope Stream to Memory Maximum Transfer Rate.vi
  • Export Arb Sample Clock.vi (if generating an external clock for Scope)
  • supporting files for Win32 File IO VI's
  • File IO benchmark utility VI's

 

Requirements


Filename: ni-scope-streaming-basic8.0.zip

Software Requirements


Application Software: LabVIEW Professional Development System 8.0
Language(s): LabVIEW

Hardware Requirements


Hardware Group: High-Speed Digitizers (Scopes)
Hardware Model: PCI-5105, PXIe-5122, PCI-5114, PCI-5122, PCI-5124, PCI-5142, PCI-5922, PXI-5105, PXI-5112, PXI-5114, PXI-5122, PXI-5124, PXI-5142, PXI-5152, PXI-5620, PXI-5922, PCI-5112
Driver: NI-Scope 3.4

 
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).