Part 1 of this article was published in the 8 July 2009 issue of Dataweek. The article provides readers with advice on obtaining optimum results from a PC-based data acquisition system.
Timing I/O. Counter/timer circuitry is useful for many applications, including counting the occurrences of a digital event, digital pulse timing, and generating square waves and pulses. All of these applications can be implemented using three counter/timer signals – gate, source and output. The gate is a digital input that is used to enable or disable the function of the counter. The source is a digital input that causes the counter to increment each time it toggles, and therefore provides the time base for the operation of the counter. Finally, the output generates digital square waves and pulses at the output line.
The most significant specifications for operation of a counter/timer are the resolution and clock frequency. The resolution is the number of bits the counter uses. A higher resolution simply means that the counter can count higher. The clock frequency determines how fast the digital source input can be toggled. With higher frequency, the counter increments faster and therefore can detect higher frequency signals on the input and generate higher frequency pulses and square waves on the output. The DAQ-STC counter/timer used on National Instruments’ E series DAQ boards, for example, has a 24-bit counter with a clock frequency of 20 MHz. This counter/timer is also an up/down counter/timer, meaning that it can use additional external digital signals to count up or down, depending on whether the level is high or low. This type of counter/timer is used in applications such as positioning from rotary or linear encoders.
Bus mastering and DMA for high system performance. An important aspect of creating DAQ-based systems is high-speed data throughput coupled with simultaneous data processing. In order to carry out system level tasks, it is important not to tie up the processor with the task of transferring data into RAM. The ISA bus uses special circuitry on the computer motherboard to perform direct memory access (DMA) on data to or from RAM. The DMA components on the PC and board handle the transfer of data between the board and RAM efficiently without requiring the microprocessor.
The PCI bus greatly extends data throughput rates up to 132 MBps and also has provisions for processor-free direct memory access. PCI differs from ISA in that it does not have DMA circuitry on the motherboard, but instead allows for ‘bus mastering’ by the DAQ board. During bus mastering, the PCI DAQ board takes control of the PCI bus, transfers data at high rates of speed, then releases the bus for other peripheral use. Figure 8 shows data being transferred into RAM by a PCI bus master.
While the data is coming in, the processor reads the data out and performs system level tasks with it. It is important to note that not all PCI DAQ boards provide bus mastering circuitry. PCI without bus mastering depends on interrupts for transfers and therefore requires processor involvement in the transfers. This degrades system performance. In fact, systems using ISA boards with DMA outperform systems using slave PCI boards. Many DAQ boards that do provide bus mastering circuitry use off-the-shelf bus mastering chips that require significant enhancement circuitry for optimal DAQ-type transfers. For example, the board might be able to transfer a quick burst of data to RAM but could not do this continuously.
For this reason, National Instruments developed the MITE ASIC. Using three separate DMA lines, the MITE seamlessly distributes data at rates in excess of 100 MBps even over non-contiguous memory areas typical of virtual memory-based operating systems, such as Windows NT and 95, using a technique called scatter-gather.
DAQ hardware without software is of little use – and DAQ hardware with poor software can be worse. The majority of DAQ applications use driver software. Driver software is the layer of software that directly programs the registers of the DAQ hardware, managing its operation and its integration with the computer resources, such as processor interrupts, DMA and memory. Driver software hides the low-level, complicated details of hardware programming while preserving high performance, providing the user with an easy-to-understand interface. NI-DAQ is the National Instruments full featured, high performance DAQ software driver.
Which functions are available? Driver functions for controlling DAQ hardware can be grouped into analog I/O, digital I/O and timing I/O. Although most drivers will have this basic functionality, you will want to make sure that the driver can do more than simply get data on and off the board. The driver should have the functionality to:
* Acquire data at specified sampling rates.
* Acquire data in the background while processing in the foreground (continuous data acquisition).
* Use programmed I/O, interrupts and DMA to transfer data.
* Stream data to and from disk.
* Perform several functions simultaneously.
* Integrate more than one DAQ board.
* Integrate seamlessly with signal conditioning equipment.
These and other functions of the DAQ driver save the user considerable development time.
Continuous (circular) data acquisition. By setting up the data buffer to act as a circular buffer, the buffer can continuously be used and re-used. As interrupts and DMA operations place data from the DAQ board into the buffer, the application program pulls data out of the buffer for processing, such as saving to disk or updating screen graphics. When the buffer is full, the interrupt or DMA operation re-initialises to the beginning of the buffer, as shown in Figure 9. In this manner, continuous data collection and processing can be sustained indefinitely, assuming the application can retrieve and process data faster than the buffer is being filled.
Similar programming methods exist for analog output, digital I/O and counter/timer operations. For example, continuous data acquisition is useful in conjunction with analog output for performing realtime monitoring and control in an application. While the board continuously acquires data in the background, the application can be computing data and generating analog output values used to control a process.
The increasing sophistication of DAQ hardware, computers and software increases the importance and value of good driver software. Properly developed driver software delivers an optimal combination of flexibility and performance, while also significantly reducing the time required to develop a DAQ application. Users should scrutinise the driver software as carefully as the DAQ hardware by asking several questions:
Which operating systems can be used with the driver? Users should make sure that the driver software is compatible with the operating systems they plan to use now and in the future. The driver should also be designed to capitalise on the different features and capabilities of the OS. For example, while drivers written for an older edition of Windows may run under a newer edition, only drivers written specifically for the new edition can take advantage of the increased performance and robustness available with the operating system. Users may also need the flexibility to easily port their code between platforms, say from Windows to Mac OS.
Which programming languages can be used with the driver? Users should make sure that the driver can be called from their favourite programming language, and is designed to work well within that development environment. A programming language such as Visual Basic, for example, has an event driven development environment that uses controls for developing the application.
Are the required hardware functions accessible in software? A problem occurs when a developer purchases DAQ hardware, then combines the hardware with software, only to find that a critical hardware feature is not handled by the software. The problem occurs most frequently when the hardware and software are developed by different companies. By asking this question, time can be saved searching through the software manuals looking for a function that does not exist. NI-DAQ, which is developed at National Instruments along with the DAQ hardware, handles every function listed on the data sheets of the DAQ hardware.
Does the driver limit performance? Because the driver is an additional layer, it may cause some performance limitations. In addition, some operating systems can have significant interrupt latencies. If not dealt with properly, these latencies can greatly reduce the performance of the DAQ system. NI-DAQ is a high-performance driver that has code written specifically to reduce the interrupt latencies of Windows and to provide acquisition rates up to 1 MSps.
The answers to these questions will provide an indication of the effort that has gone into developing the driver software. Ideally, users should look for driver software from a company that has as much expertise in the development of the DAQ software as they do in the development of DAQ hardware.
Application software. A common and efficient way to program DAQ hardware is to use application software. Even if using application software, it is important to know the answers to the previous questions, because the application software will use driver software to control the DAQ hardware. Application software adds analysis and presentation capabilities to the driver software. The application software also integrates instrument control (GPIB, RS-232, and VXI) with data acquisition.
National Instruments offers three development environment software products for developing complete instrumentation, acquisition and control applications:
* LabVIEW with graphical programming methodology.
* LabWindows/CVI for traditional C programmers.
* Measurement Studio for Visual Basic, C++ and .NET.
The introduction of LabVIEW SignalExpress provides a configuration-based software environment where programming is no longer a requirement.
© Technews Publishing (Pty) Ltd | All Rights Reserved