Vous êtes sur la page 1sur 204

Data

Acquisition
Developed by Advantech IAG Training Center

(Internal Use Only)

Advantech IAG Training Center (Internal Use Only)


I

Table of Contents
(Internal Use Only).......................................................................................................I
Table of Contents..........................................................................................................I
Chapter 1 Introduction..........................................................................................1
1.1 DA&C system Overview...........................................................................1

1.2 Application Stories.....................................................................................2

1.2.1 Portable Thermo Test System.........................................................2

1.2.2 Tone Quality Analysis System.......................................................4

1.2.3 Real-Time Testing System for Wind Power Generation Machine. 7

1.2.4 Self-Service Book Borrowing and Returning System.................10

1.3 Learning Purpose.....................................................................................13

1.4 Structure of Textbook...............................................................................14

Chapter 2 Essential Concepts..............................................................................17


2.1 Data Acquisition & Control System.........................................................17

2.2 Fundamental of DA&C System...............................................................19

2.2.1 Transducers..................................................................................20

2.2.2 Signal Conditioning.....................................................................22

2.2.2.1 Isolation........................................................................................23

2.2.2.2 Filtering........................................................................................24

2.2.2.3 Amplification and Attenuation.....................................................26

2.2.3 Data Acquisition & Control Hardware.........................................27

2.2.3.1 Analog Input.................................................................................27

2.2.3.2 Analog Output..............................................................................42

2.2.3.3 Digital Input.................................................................................45

2.2.3.4 Digital Output...............................................................................52

2.2.3.5 Counter.........................................................................................58

Chapter 3 Product Introduction.........................................................................61


II

3.1 I/O Product Interface................................................................................61

3.1.1 ISA/PC-104 Interface...................................................................62

3.1.2 PCI/PCI-104 Interface..................................................................63

3.1.3 CPCI Interface..............................................................................65

3.1.4 USB Interface...............................................................................67

3.2 Naming Rule............................................................................................69

3.3 I/O Selection Guide..................................................................................79

Chapter 4 Getting Started...................................................................................89


4.1 Startup of DAQ cards...............................................................................89

4.1.1 Introduction of the Advantech Device Manager..........................90

4.1.2 Startup of ISA cards...................................................................102

4.1.3 Startup of PCI, USB and CPCI cards.........................................111

4.2 The introduction of WaveScan2.0..........................................................120

Chapter 5 Software Introduction......................................................................135


5.1 Advantech Device Driver.......................................................................135

5.1.1 Examples of the Advantech Device Driver................................138

5.2 Advantech ActiveDAQ Pro Driver........................................................141

5.2.1 Features of the ActiveDAQ Pro Driver......................................143

5.2.2 Examples of the ActiveDAQ Pro Driver....................................150

5.3 Advantech LabView Driver...................................................................153

5.3.1 LabView Driver..........................................................................156

5.3.2 LabViewDAQ Driver.................................................................158

5.4 Programming (Advanced)......................................................................165

5.4.1 AI Transferring by Software Polling..........................................165

5.4.2 Fast AI Transferring...................................................................170

5.4.2.1 Fast AI Transferring by Interrupt...............................................179

5.4.2.2 Fast AI Transferring by DMA....................................................187

5.4.3 The programming for the AvtiveDAQ Pro Driver.....................193


III

Chapter 6 Trouble Shooting..............................................................................208


6.1 PCI-1710HG with Thermocouple..........................................................208
IV
1

Chapter 1 Introduction

1.1 DA&C system Overview

While Embedded Controllers are well proven through several industrial

applications, the new trend will be to separate the computing platform from the data

acquisition interface. In this way, users can experience high-performing, reliable

computing platforms and the latest in embedded technology, while saving on

maintenance costs and system upgrade efforts.

With over 25 years of Plug-in I/O card design and manufacturing experience,

Advantech has become a global leader, providing a full range of industrial data

acquisition and control products. There are five major categories - CompactPCI, PCI-

bus, ISA-bus, USB-bus, PC/104 & PCI-104 modules. With rich wiring terminal

modules and software support, Advantech provides high-speed, high quality, yet cost-

saving products for industrial requirements. Advantechs USB-4700 for example,

provides versatile rugged mounting kits and dual lockable cables for industrial test

and measurement applications.

Advantech IAG Training Center (Internal Use Only)


2

1.2 Application Stories

1.2.1 Portable Thermo Test System

Project Introduction:

LED flashlights are gaining popularity in the industrial field, not only do they

save energy, but they are also lighter and cheaper than their traditional counterparts.

One of our clients is a major manufacturer of automotive repair tools, including LED

flashlights, and they were looking to reduce the battery requirements in their

flashlights down to a one coin cell battery. Thus, they turned to Advantech help them

design a rise-voltage circuit for driving the LED.

System Requirements:

The manufacturers outsourcing team wanted to leverage Advantechs industrial-

grade USB DAQ module to verify their thermo specifications, which was difficult to

gauge due to the interference from the voltage circuits inside the flashlight. To make

sure quality is under control, they were looking for products that:

Advantech IAG Training Center (Internal Use Only)


3

Provided speed data transmission rate

Provided firm mounting and installation kits

Provided firm cable connections

Provided ready to use utilities for data logging

System Description:

USB-4718 was used to connect with thermocouple sensors, and then transfer

data to the desktops HDD. The WaveScan utility inside the desktop is free, providing

data logging, real-time waveform and historical trend functions. All the signals can be

displayed on the screen in real-time, providing offline analysis or transfer of the data

into Excel format for further data analysis at a later time.

Conclusion:

After implementing Advantech products, the client not only saved cabling and

installation efforts, they also saved 70% on the test stations cost. Moreover, this test

tool can be used in the central or subcontractors office, providing increased flexibility

for the engineers.

Advantech IAG Training Center (Internal Use Only)


4

Figure 1.2.1-1 System Diagram

1.2.2 Tone Quality Analysis System

Project Introduction:

Many industrial applications leverage audio to improve performance. One of our

clients is a major manufacturer of consumer electronics devices, and they were

looking to reduce the cost of their audio quality analysis system. Thus, they turned to

Advantech to help them create a simple yet cost-effective solution to improve

efficiency and increase production.

System Requirements:

Advantech IAG Training Center (Internal Use Only)


5

Our clients in-house R&D team wanted to create a PC-based measurement and

testing solution to analyze audio quality, and hoped to reduce costs compared to

traditional, proprietary test stations. Their requirements included:

Multiple analog input channels to test many products at the same time

A high gain interface for analyzing microphone signals

Multiple digital input/output channels to trigger the objects (electronic

devices)

GPIB card to communicate with instruments

System Description:

The PCI-1710HGs digital output channels were used to trigger the electronic

devices, which play preloaded music. The PCI-1710HGs analog input channels were

used to connect to the earphone port, which acquires audio signals from the electronic

devices. The test application will verify the data to see if the conditions match or not.

After that, the display will show the pass or fail information to the operator.

Conclusion:

Compared to their previous solution (proprietary test workstation), this new

Advantech IAG Training Center (Internal Use Only)


6

solution increased production by 50% (it can now test two electronics devices at the

same time) and saved 29% on the test workstations cost. This solution can test all

audio electronic devices with specific fixtures. Furthermore, the ease of operability

allows their local R&D teams to mange the system themselves, reducing maintenance

costs.

The PCI-1710HGs advanced circuit design provides high quality with advanced

functions, including the five most popular measurement and control functions: 12-bit

A/D conversion, D/A conversion, digital input, digital output and counter/timer. The

high gain design allowed this system to measure even small signals (+/- 0.005V)

without any extra amplifier circuit.

Advantech IAG Training Center (Internal Use Only)


7

Figure 1.2.2-2 System Diagram

1.2.3 Real-Time Testing System for Wind Power Generation

Machine

Project Introduction:

The INER (Institute of Nuclear Energy Research) in Taiwan uses an embedded

platform real-time system to create a Wind Power Generation Simulation Platform,

which simulates the wind and blade models they build in Simulink. Through this

unique solution, INER can modulate the speed of the dynes based on actual wind

direction and strength. This affordable and robust multi-function platform can rapidly

control prototype and hardware-in-the-loop test applications. The system is installed

Advantech IAG Training Center (Internal Use Only)


8

with Advantechs UNO-2170 and PCM-3718HO.

System Requirements:

INER wanted to develop a simulation and test station for their wind power

generation machines. To do so, they needed a rugged and robust real-time system to

run hardware-in-the-loop testing. Therefore, INER made a request for a new system

include following requirements:

Real-time analysis and control systems testing needs.

Rugged, high-performance industrial PC which is fanless, low-power

consumption design, sturdiness, compact size and also can support all

standard PC peripherals.

Standalone ability, xPC self-installed software tools are able to run on

stand-alone mode. And users can burn the pre-set model to CF card without

connecting through internet.

System Description:

The customer used Simulink to build their physical wind and blade models, and

an embedded platform with Advantechs UNO-2170 and PCM-3718HO devices to

Advantech IAG Training Center (Internal Use Only)


9

create a Wind Power Generation Simulation Platform for the HIL simulation. The

goal of the simulation is to gauge the efficiency and performance of their power

generation machines, including stress-testing. From the results of HIL simulations,

they can then modulate the speed of dynes according to the actual wind direction and

strength, driving the shaft of wind power generator.

Conclusion:

INERs engineers need to run real-time analysis and control system testing to test

the wind power generation machines, and this platform offers an excellent

combination of performance, compact size, sturdiness, and I/O expandability. By

integrating Advantechs UNO-2170 to customize various requirements and integrating

MATLAB/Simulink and related control modules, the engineers can conduct real-time

modeling and simulation of control systems, rapid prototyping, and hardware-in-the-

loop testing without the need of manual code generation and complicated debug

processes. This results in significant cost savings and reduced development time.

Advantech IAG Training Center (Internal Use Only)


10

Figure 1.2.3-3 System Diagram

1.2.4 Self-Service Book Borrowing and Returning System

Project Introduction:

Recently libraries have been extending beyond the physical walls of a building,

by including material accessible by electronic means. Library 2.0, a term coined in

2005, is the librarys response to the challenge of Google, and an attempt to meet the

changing needs and wants of the users, using Web 2.0 technology. Some aspects of

Library 2.0 include commenting, tagging, bookmarking, discussions, using social

software, plug-ins, and widgets. Inspired by Web 2.0, it is an attempt to make the

Advantech IAG Training Center (Internal Use Only)


11

library a more user-driven institution.

System Requirements:

One of Koreas top vending machine makers wanted to leverage RFID (Radio

Frequency Identification) to design a modern self-service book borrowing and

returning system. The idea was that customers reserve a book through the librarys

website, choose the location to physically pick up the book, and the computer would

provide the customer with a special barcode that they should print out and bring with

them. The customer then simply goes to the assigned location, shows the printed

barcode information to the vending machine, and the reserved book would show up

automatically.

Customers could also return the book to any applicable vending machine, and

due to the fact that all books are tagged with an RFID, the librarys website and

vending machine system can deliver and trace all the books automatically. To

complete this project, they required:

Compact digital I/O modules with a built-in wiring terminal block

Easy to mount

Advantech IAG Training Center (Internal Use Only)


12

Firm cable connection

System Description:

In this solution, the USB-4751 is setup to control the drawer switches when the

information is retrieved from the barcode/RFID readers. Alternately it can sense

which drawer is not occupied for customers to return their books. The USB-4622 acts

as a USB hub to gather all the necessary information. The industrial display interacts

automatically with customers, which is considerably time-saving and cost-saving.

Conclusion:

This system is the first library 2.0 system in Korea, and was integrated with an

online shopping business model, RFID and vending machine technology. Not only

was the manufacturer able to save cabling and installation efforts, but also a lot of

maintenance effort by leveraging Advantechs DiagAnywhere utility. All of the

vending machines operations can be monitored remotely from the central control

room.

Advantech IAG Training Center (Internal Use Only)


13

Figure 1.2.4-4 System Diagram

1.3 Learning Purpose

The purpose of this textbook is to assist beginners to learn the basic concept of

DA&C system, understand how to use Advantech DAQ products and do the

programming with Advantech DAQ drivers. If you are already familiar with the basic

knowledge, it is recommended to directly visit the latter (i.e., Chapter 5) which puts a

stress on software programming to improve users skill of DAQ control. After reading

this textbook, we expect that the users can know the architecture of DA&C system

well and its basic knowledge, and will also enhance the ability of using Advantech

Advantech IAG Training Center (Internal Use Only)


14

utilities and examples in relation to the control the DAQ products by the Hands-on

practice. Examples introduced in this textbook can be further modified by users to

create their programs in a short term to meet the requirements of their applications.

1.4 Structure of Textbook

This textbook will be separated into five chapters. In Chapter 1, the overview of

industry and the application story of the data acquisition will be introduced. In

Chapter 2, the architecture of DA&C system and related features involved will be

addressed, especially the functions of DAQ hardware such as AI, AO, DIO and

counter. In terms of I/O interface, how to select a suitable Advantech DAQ product

for your application will be described in Chapter 3. Chapter 4 will show users how to

install Advantech DAQ products in the computer and you will find it is very easy to

control Advantech DAQ products by the utilities. Finally, software drivers and

examples given in Chapter 5 will lead users to experience how to use various

Advantech drivers for programming with different kinds of software program. This

Chapter will also introduce the advanced programming.

Advantech IAG Training Center (Internal Use Only)


15

Advantech IAG Training Center (Internal Use Only)


16

Advantech IAG Training Center (Internal Use Only)


17

Chapter 2 Essential Concepts

The purpose of this chapter is to give users an overview about DA&C system.

Basic knowledge, common features and useful functions in relation to DA&C will be

introduced.

2.1 Data Acquisition & Control System

First of all, DA&C is the abbreviation of Data Acquisition & Control. Due to

the advancement of computer technology, the speed of CPU becomes faster and the

performance of computers dramatically increases. Consequently, DA&C system is

getting more attractive and popular; that is to say, more and more users tend to choose

PC-Based control (i.e., DA&C system) for their application.

Advantech IAG Training Center (Internal Use Only)


18

In general, most of signals in the nature derive from temperature, pressure or

position. But how can we measure these analog signals by the PC which can read

digital codes only?

The first thing we need to do is to select matched sensors, so as to capture

physical phenomena and transfer them to suitable signals which can be further

handled by DAQ cards. With the purpose of noise reduction and signal adjustment,

the signal conditioning such as filtering, amplification or attenuation should be

taken into account before the measurement. Subsequently, DAQ cards are required to

conduct the process of data acquisition and convert signals from analog to digital.

After capturing related signals, we can go further to display what we get, analyze

what signals mean and react to what happens; as a result, a computer with software

relative to data display and monitor is imperative. In order to control something

outside, we need the computer to send commands to next devices (e.g., actuators).

The implication is that signals are re-converted from digital to analog through DAQ

cards, so as to change physical phenomena in the environment.

Therefore, the DA&C system can be viewed as a closed loop process (see Figure 2-

1), starting with sensors, then signal conditioning, DAQ cards and PC with

Advantech IAG Training Center (Internal Use Only)


19

corresponding software, finally ending with actuators.

Figure 1.2.4-5 DA&C System

2.2 Fundamental of DA&C System

As mentioned in Section 2.1, industrial PC-based DAQ products have become

increasingly reliable, accurate and affordable in the last few years. The PC-based

DA&C systems are now widely used in industrial and laboratory applications.

Therefore, it is worth knowing how to select and build a DA&C system. This section

Advantech IAG Training Center (Internal Use Only)


20

will give you an introduction about how a DA&C system operates and how to

configure such system. The contents are separated into Transducers, Signal

Conditioning, Data Acquisition & Control Hardware and Selection Guide which

will be introduced in turn.

2.2.1 Transducers

The transducer is usually adopted to convert temperature, pressure, length or

position into voltage, current or other signals. There are many kinds of transducers

such as thermocouple (for temperature measurement), strain gauge (for stress/strain

measurement) and pressure sensor (for pressure measurement). Here we briefly

introduce the thermocouple which is used often in automation industry.

The thermocouple operates on the principle that the junction of two dissimilar

metals generates a voltage that varies with the temperature (see Figure 2-2).

Measuring this voltage is difficult because connecting the thermocouple to a DAQ

card also causes so-called reference junction or cold junction. These additional

Advantech IAG Training Center (Internal Use Only)


21

junctions act as thermocouples themselves and produce their own voltages. Thus, the

final measured voltage (i.e., Vmeas) is the combination of the voltage generated by the

thermocouple and the voltage deriving from the cold junction. The method used to

compensate for these unwanted cold-junction voltages is called Cold-Junction

Compensation (CJC).

Figure 2-6 The operation of the thermocouple

There are a number of thermocouples available in the market, such as J type, K

type, and so on. In Figure 2-3, we can see that the measurable temperature range as

well as the temperature coefficient of each type of thermocouples is different from

each other. In order to get accurate temperature readings through the thermocouple, it

is necessary to take CJC into consideration and implement the calculation based on

the conversion rule. It is a tough task; fortunately, most of software applications (e.g.,

Advantech IAG Training Center (Internal Use Only)


22

Advantech Device Manager, Advantech DAQ drivers) can support this conversion

from voltage to temperature.

Figure 2-7 The temperature range of each thermocouple type

2.2.2 Signal Conditioning

Generally, signal conditioning is used to manipulate analog signals so that these

signals can meet the requirements of the following stage for further processing.

Besides, the signal conditioning is able to improve the quality of analog signals from

transducers before they are converted into digital signals by PC-based DAQ cards.

The functions of signal conditioning include isolation, filtering, amplification and

attenuation; these functions will be described in following sections one by one.

Advantech IAG Training Center (Internal Use Only)


23

2.2.2.1 Isolation

Grounding does matter in signal measurement. Common problems, for example,

noise interference or component damage, are likely caused by improper grounding.

Signal conditioners with isolation can remove such problems. This kind of devices

passes the signal from its input (i.e., signal source) to its output (i.e., measurement

device) through transformers, optical components, or capacitive coupling circuits (see

Figure 2-4); put simply, there is no physical contact or connection between its input

and output during transmission. Besides, due to separated grounds, the isolation can

block high-voltage surges or interference current on input side, and prevent both

components on output side and following devices from the damage caused by high

common-mode voltage (Vcm) which is the difference of voltages between the local

ground and ground of the DAQ card. It means if one side of the signal source is

connected to a local ground, the signal source will be ground-referenced. But the

ground of the signal source and the ground of the card will not be exactly of the same

voltage. The difference between the ground voltages forms a common-mode voltage.

Advantech IAG Training Center (Internal Use Only)


24

Figure 2-8 Isolation signal conditioner can prevent the problem

2.2.2.2 Filtering

Another feature of signal conditioning is to serve as the filter to eliminate unwanted

noise within a certain band of frequency. In most cases, data acquisition is likely

subject to noise with 50 or 60 Hz which may come from power lines or machinery. As

a result, signal conditioning is often equipped with low-pass filtering to get rid of such

noise (see Figure 2-5).

Filters are also used to prevent signal aliasing (i.e., a phenomenon caused by

lower sampling rate for a signal with higher frequency). According to Nyquist

theorem, if the frequency of partial sub-signals (i.e., a measured signal consists of

Advantech IAG Training Center (Internal Use Only)


25

sub-signals) is greater than one-second sampling rate, the measured signal could be

distorted and such sub-signals are usually defined as noise. The solution to the above

problem is to implement low-pass filters to screen this kind of sub-signals before the

measured signal is sampled.

Figure 2-9 The Low pass filter can prevent signal aliasing

2.2.2.3 Amplification and Attenuation

Due to the fact that signals from transducers tend to be small in magnitude,

amplifying signals to better match the input range of following devices (e.g., analog-

to-digital converter) is required often (see Figure 2-6). When signals are big enough,

the measurement error caused by limited resolution (i.e., 1 LSB, Least Significant Bit)

Advantech IAG Training Center (Internal Use Only)


26

can be ignored. On the contrary, when signals are smaller, 1 LSB could have a

significant influence on the measurement result. Thats why most of DAQ products

support on-board amplification.

However, noise like signals probably becomes bigger through amplification, which

does affect the accuracy of measurement. In order to improve this situation, increasing

signal-to-noise ratio is a way to go. Normally, amplifiers tend to be located around

signal sources or transducers, and intensify the measured signals before they are

affected by environmental noise.

Figure 2-10 The amplifier or attenuator can boost the level of the input signal to better

match the range of the ADC

Advantech IAG Training Center (Internal Use Only)


27

2.2.3 Data Acquisition & Control Hardware

Data acquisition and control hardware generally performs one or more of the

following functions: Analog Input, Analog Output, Digital Input, Digital Output and

Counter/Timer functions. This section will introduce these functions and explain some

essential concepts that users have to understand before selecting products.

2.2.3.1 Analog Input

Normally, physical properties such as temperature, pressure, flow, pH and speed

tend to become a form of analog signals through sensors or transducers, and have to

be subsequently converted into digital ones before entering the main system for

further processing (e.g., displaying, analyzing or storing). This conversion from

analog to digital is essential and inevitable, so that analog-to-digital conversion can be

seen as the groundwork of DA&C system.

Advantech IAG Training Center (Internal Use Only)


28

Figure 2-11 The Analog Input card can transform the analog signal to the digital value

The common specification of AI (i.e. Analog Input) is shown in Table 2-1, these

items are often used to represent the performance of AI cards. This section will give

you an overview about significant properties in relation to AI function, such as the

operation of multiplexer, input mode, sampling rate, resolution, trigger clock, data

transfer mode, and so on.

Spec. Item Example


Number of Channels 16 channels or more
Input Mode Differential or Single-Ended
Polarity Unipolar (0~10V) or Bipolar (+/-10V)
Input Range Gain Code
Resolution 12-bit or 16-bit
Data Transfer Mode Software Polling, Interrupt, DMA

Advantech IAG Training Center (Internal Use Only)


29

Sampling Rate Share with the MUX or Independent


Trigger Clock Pacer, Software, External
Table 2-1 The specification of Analog Input

(a) Multiplexer (MUX)

The multiplexer serves as a resource allocator and allows one of channels to

reach ADC (i.e., Analog-to-Digital Converter) at a time. As shown in Figure 2-8, the

multiplexer selects a channel in turn and then passes the signal of that channel to ADC

for data conversion. Typically, ADC is the most valuable part of AI cards and nearly

determines the price of such products. Through the multiplexer, one ADC can be

shared by a number of AI channels. In other words, the multiplexer offers a cost-

effective way to meet the requirement of massive AI channels.

Advantech IAG Training Center (Internal Use Only)


30

Figure 2-12 The specification of Analog Input

On the other hand, simultaneous data acquisition for all channels is required

sometimes. The multiplexer, in fact, fails to acquire data at the same time because the

ADC behind the multiplexer is shared by all channels. In such context, one ADC for

one AI channel (e.g., PCI-1714, see Figure 2-9) is recommended for this kind of

application, but always coming with a higher price.

Advantech IAG Training Center (Internal Use Only)


31

Figure 2-13 PCI-1714U (Simultaneous 4-ch Analog Input Universal PCI Card)

(b) Input Mode

Two input modes are relative to AI function, namely single-ended mode (SE) and

differential mode (Diff). In the SE mode, voltage reference (e.g., AIGND in Figure

2-10) is always fixed and co-owned by all AI channels; but in the Diff mode, each

channel has its own voltage reference (e.g., AI0-AI1, AI2-AI3, see Figure 2-11).

Advantech IAG Training Center (Internal Use Only)


32

Figure 2-14 Single-ended input channel connection

Figure 2-15 Differential input channel connection

Please note that in the Diff mode it is necessary to form the pair and the pair is

unchangeable (i.e., AI0-AI1, AI2-AI3, , AI14-AI15). As a result, the number of

channels in the Diff mode is half of the SE mode. Furthermore, the SE mode and the

Diff mode can coexist on the same AI card. For instance, Advantech DAQ cards

support these two input modes and allow users to set channels as SE or Diff

Advantech IAG Training Center (Internal Use Only)


33

individually through software configuration.

(c) Resolution and Sampling Rate

According to Figure 2-12, Sample & Hold and Quantization are central to

the process of AD conversion. First of all, an oscillator providing a pacer rate to the

ADC for data sampling is needed. When an analog signal is acquired as a discrete

signal by sampling, the latter has to be held steadily for a while so that the following

process of quantization can be done in the given time. After that, the discrete signal is

transferred to the digital signal (i.e., binary data) and the process of AD conversion is

completed.

Figure 2-16 Sample & Hold and Quantization

Advantech IAG Training Center (Internal Use Only)


34

In order to fully understand the process of conversion, two things have to be

addressed in the first place, that is, sampling rate and resolution. The sampling rate

means the number of samples per second (or other time unit) users want to acquire

through the ADC, and the resolution means the least change the ADC can recognize.

Normally, the unit for the sampling rate is Hz whereas the unit for the resolution is

bit.

For the sampling rate, users have to know something about the Nyquist sampling

theorem first. As mentioned in Section 2.2.2.2, the Nyquist theorem states that the

perfect reconstruction of a signal is achievable if sampling frequency is greater than

twice the maximum frequency of a sampled signal. Therefore, the greater the

sampling rate is, the higher the probability to rebuild the original signal based on the

sampled signal is (see Figure 2-13).

However, the sampling rate is shared by all channels if a multiplexer is adopted.

For example, the maximal sampling rate of PCI-1710 is 100KHz. Due to the

implementation of multiplexer, users can determine how many channels they want to

employ for data acquisition. If one channel is used only, the maximal sampling rate

for this channel is 100KHz/1ch = 100KHz/ch. If four channels are adopted at the

Advantech IAG Training Center (Internal Use Only)


35

same time, the maximal sampling rate for each channel is 100KHz/4ch = 25KHz/ch.

But AI cards without multiplexer (i.c., one ADC for one channel, such as PCI-1714)

are exceptions; in that case, the maximal sampling rate for each channel is the same

with the maximal sampling rate of the ADC.

Figure 2-17 Higher sampling of ADC results in better conversion

In terms of the resolution, LSB (Least Significant Bit) is often used to

represent the smallest unit which can be identified by the ADC. For instance, if the

input range is 0~10V and 8-bit ADC is adopted, the full scale (i.e., 10V) can be

separated into 256 (i.e., 28) pieces and each piece (i.e., LSB) is equal to 40mV (i.e.,

10V/256). If the ADC is upgraded from 8-bit to 16-bit, 1 LSB is lessened to 150uV

(i.e., 10V/216), that indicates the accuracy of data conversion is much increasing.

Advantech IAG Training Center (Internal Use Only)


36

Figure 2-18 Higher resolution of ADC results in better quantization

(d) Data Transfer Mode and Trigger Clock

Three modes of AI data transfer, namely software polling, interrupt and

DMA (Direct Memory Access) will be introduced as follows.

The software polling is a simple way to react to special conditions. This involves

a users program which is connected to signal measurement, data analysis, decision

algorithm and pre-defined action. This program periodically checks the systems clock

or external trigger input so as to sense a sign for action taking. Whenever a sign is

detected, the program starts sampling each of inputs, stores acquired data in a frame

Advantech IAG Training Center (Internal Use Only)


37

and then stops to wait for next sign. A frame is simply a list that contains the values

representing the acquired signals at the specific time; besides, frames can be saved in

RAM, or other types of memory for further use. With the software polling, the data

transfer rate can be up to 10KHz or higher, that totally depends on the performance of

a computer adopted by users. Furthermore, the data transfer rate cant be exactly fixed

all the time because the resource of the computer allocated to this program is not

always stable. In other words, the computer could constantly stay busy when the

polling loop is going, that implies no other tasks can be served then. If the above is a

concern, the interrupt or DMA mode which is executed in the background can be

taken into account.

The interrupt mode is a mean to accurately control the timing of events,

especially more than one tasks are executed. Multitasking systems can be referred to

as Foreground/Background systems. One way to execute the program relative to

data acquisition in the background is to use an interrupt routine. The system clock or

external timing signal, rather than the polling loop, is usually used to generate an

interrupt to the computer. Whenever the interrupt occurs, the computer suspends

current activities and executes an Interrupt Service Routing. The interrupt service

routing in this case might be a short program which requests one frame of data and

Advantech IAG Training Center (Internal Use Only)


38

stores it in memory. After the interrupt service routine is done, the computer resumes

the tasks from where they leave off in the beginning. Compared with the software

polling, the computer can perform other tasks in the foreground during data collection

except the interrupt service routine is executed (i.e., moving acquired data to

memory); besides, the data transfer rate through the interrupt mode can be up to

200KHz (e.g., USB-4716) which is much higher than the software polling.

The DMA mode offers a way to transfer data into memory at a higher rate

without getting the CPU involved. Actually, DMA is a kind of technique that leads to

high-speed data transfer from or to random access memory (RAM); in the meanwhile,

tasks connected to the CPU are not affected while reading or writing data at precise

points of time through the DMA mode. For example, data can be written to RAM at a

rate of up to 30MHz (e.g., PCI-1714) under DMA control, and this can be done

without taking time from the tasks of the microprocessor. Compared with the

interrupt, the amount of time required to respond to a DMA request is relatively

shorter. In conclusion, the DMA mode facilitates high-speed data transfer without the

CPU intervention, more urgent tasks such as data analysis and graphic manipulation

can be handled by the CPU timely. Moreover, it also allows users to run all I/O

functions simultaneously at a full speed without the concern of losing data.

Advantech IAG Training Center (Internal Use Only)


39

The comparison between the software polling, the interrupt and the DMA mode

is arranged and shown in Table 2-2.

Software Polling Interrupt DMA


Operation Foreground Background Background
CPU Loading High Low Lower
Sampling Rate Up to 100KHz Up to 200KHz Up to 30MHz

(Depends on PC (e.g., USB-4716) (e.g., PCI-1714)

performance)
Table 2-2 The difference between Software Polling, Interrupt and DMA

Figure 2-15 gives you a clear picture about the operation of data transfer. For the

software polling mode, a request from software program enables the ADC to sample

signals and move acquired data to PCs memory. In this case, the data transfer rate

depends on PCs performance and users program. For the interrupt or DMA mode,

acquired data are moved to on-board FIFO (First-In, First-Out) rather than PCs

memory, and this process doesnt get the CPU involved. Actually, the FIFO serves as

a buffer for acquired data, and generates buffer change event to move the

accumulated data to the PC at a time when the levels of 1/2 FIFO and full FIFO are

reached. Consequently, the data transfer rate can be much higher than the software

Advantech IAG Training Center (Internal Use Only)


40

polling.

On the other hand, a pacer signal is required to trigger the ADC for data

conversion. Generally, the pacer signal can be supplied through three modes, namely

software trigger, internal pacer trigger and external trigger. The software

trigger means that the ADC is enabled by software commands; the internal pacer

trigger can provide stable and fast pulses to the ADC for high-speed data acquisition;

the external trigger allows users to take advantage of external devices to offer pulses

to the ADC for data conversion.

Figure 2-19 The operation of software polling, interrupt and DMA

Advantech IAG Training Center (Internal Use Only)


41

2.2.3.2 Analog Output

Analog output (AO) is just opposite to analog input (AI). Like the role of ADC in

AI function (i.e., transfer data from analog to digital), Digital-to-Analog Converter

(DAC) is required and at the heart of AO function (i.e., transfer data from digital to

analog). For example, a request to output 5V (i.e., digital command) is sent from the

PC and fulfilled by the DAC (i.e., generate analog signal).

Figure 2-20 The Analog Output card can output the analog signal from the computer

Advantech IAG Training Center (Internal Use Only)


42

The common specification of the AO function is shown in Table 2-3, the items in

the table are often used to show the performance of AO cards. This section will

introduce these significant properties in relation to AO function, such as resolution,

data transfer mode as well as output mode.

Spec. Item Example


Number of Channels 4 channels or more
Polarity Unipolar (0~10V) or Bipolar (+/-10V)
Resolution 12-bit, 14-bit or 16-bit
Data Transfer Mode Software Polling or DMA
Output Mode Static Update or

Waveform Output (PCI-1712 and PCI-1721)


Table 2-3 The specification of Analog Output

The description about the resolution of ADC is applicable to the resolution of

DAC, please refer to Section 2.2.3.1 (c) for details. With regard to the data transfer

mode, the software polling and the DMA mode are available for the AO function only,

please refer to Section 2.2.3.1 (d) to get more information about these two modes if

necessary. In terms of the output mode, there are two kinds of modes for users

selection, namely static update and waveform output. The former acts like the

software polling with a lower update rate, whereas the latter allows outputting a

Advantech IAG Training Center (Internal Use Only)


43

waveform at a fixed and higher rate through the DMA transfer. PCI-1712 (1MHz) and

PCI-1721 (10MHz) both support the waveform output mode. However, the frequency

marked here doesnt mean the frequency of analog signal users can output through

this mode, it represents the number of points users can adopt to form a desired

waveform. For instance, users can have PCI-1712 output 1M points to structure a sine

waveform with 10KHz, which means this sine waveform should be composed of

around 100 points (actual output frequency also depends on other parameters in the

program).

2.2.3.3 Digital Input

Digital Input (DI) is usually used to get the status information of external devices

by sensing the level of measured voltages (see Figure 2-17). Rather than actual

readings in the AI, two states (i.e., on and off) are addressed in the DI function.

Normally, if the voltage of a measured signal for certain DI channel (or bit) is higher

than a specific value, the DI reading will be 1 and the status will be recognized as

on. On the contrary, in the context of lower than a specific value, the DI reading

Advantech IAG Training Center (Internal Use Only)


44

will be 0 and the status will be viewed as off.

Figure 2-21 The Digital Input card can receive or monitor On/Off status of a device

Table 2-4 presents common specification about the DI function. These items can

be used to show the features of DI cards. In this section, some significant properties

such as input level and interrupt function will be explained in detail.

Spec. Item Example


Number of Channels 16 channels or more
Input Level TTL or Isolated
Input Range TTL (0~5V) or Isolated DI (5~25VDC or higher)
Interrupt Function Event, Status Change, Pattern Match
Data Transfer Mode Software Polling, DMA (PCI-1755 only)
Table 2-4 The specification of Digital Input

Advantech IAG Training Center (Internal Use Only)


45

(a) Input Level

In general, there are two kinds of input level for the DI function, namely TTL

(Transistor-Transistor Logic) and Isolated digital input.

TTL is a class of digital circuits in combination of BJT (Bipolar Junction

Transistors) and resistors. The name Transistor-Transistor Logic comes from the

feature of transistors which leads to the implementation of logic gate (e.g., AND, OR)

and amplification in digital circuits.

The symbol of switch is commonly adopted in DI diagrams to represent on/off

states. According to the position of switch, the way of connection for DI channels can

be classified into Dry Contact (i.e., always open) and Wet Contact (i.e., always

closed). In Figure 2-18, a pull-high resistor (i.e., 10K) is implemented to keep the

input at a high level (i.e., 5V). If the dry contact is used, due to the aforementioned

pull-high resistor, the DI will always stay high until the dry contact is closed (i.e.,

connecting to GND). If the wet contact is applied, an external source is required to

supply a voltage to the DI, so that the DI status fully depends on the output of the

Advantech IAG Training Center (Internal Use Only)


46

external source. The user can select an external source which can offer 3.3V or 5V to

DI channels in order to meet the TTL input level. Generally, the TTL DI presents

high when a measured signal is between 2.0~5V DC, and changes to low when the

signal drops to 0~0.8VDC. The range of 0.8~2VDC is viewed as Tri-State, that means

the DI status could vary in this gray area.

Figure 2-22 Dry contact and Wet contact for TTL DI connection

As mentioned in Section 2.2.2.1, the isolation is often used to prevent sensitive

components or circuits from the damage caused by noise interference. This function

can be applied to the DI to increase the degree of protection. In most cases, the

isolated DI (IDI) is designed through photo couplers which can transfer a signal

between two separated circuits in an optical way, so that the input level of the IDI can

be up to 25V or higher.

Advantech IAG Training Center (Internal Use Only)


47

Similarly, the dry contact and the wet contact, mentioned in TTL section, can also

be applicable to the IDI (see Figure 2-19). A pull-high resistor makes the IDI stay high

in the first place. When the IDI channel is connected to the GND through the dry

contact, the IDI status changes to low. If the wet contact is utilized, the IDI status will

be subject to the external source. For example, the IDI of PCI-1750 presents high if

5~48V is supplied and becomes low if the voltage is decreased to 0~2V.

Figure 2-23 Dry contact and Wet contact for Isolated DI connection

(b) Interrupt Function

Advantech IAG Training Center (Internal Use Only)


48

It is worth stressing that the DI can act as interrupt triggering. An interrupt relative

to a change in state for each DI channel equips users to monitor the DI status more

efficiently. Three types of interrupt users can take advantage of include Event

Trigger, Status Change and Pattern Match.

The event trigger is commonly adopted compared with the other two. With this

function, if the state of the DI changes, an interrupt signal will be generated and

delivered to the system to handle this event. The event trigger can be activated by a

rising edge, a falling edge, or both at the same time, this setting should be based on

users application. For instance, if a user wants to give an alarm as soon as the

restaurant is on fire, a DI card can be applied to check a change in state through a

smoke detector. Once the DI status changes, the DI card will send an interrupt to the

PC to enable the alarm.

Similar with the event trigger, the status change function can help users to monitor

changes in state of DI channels. It can monitor the status of the enabled digital input

channels and when one of the enabled channels changes its state, the DI card will

deliver an interrupt signal to the system to handle this event. It means we can detect if

there is any status change for several channels by using the status change function.

Advantech IAG Training Center (Internal Use Only)


49

The pattern match offers a way to check whether changes in some specific DI

channels simultaneously meet the criteria preset by users. That is to say, the status of

DI channels is under supervision and the comparison between the measured and the

pre-defined is made constantly. When the measured matches the pre-defined, the DI

card will deliver an interrupt signal to the system for further processing. For example,

we can set a default value (i.e., FF) of one DI port, and there will be an interrupt once

all the DI channels are high which means FF. This function releases the CPU from

the burden of polling all of I/O points, and enables the PC to handle more I/O points

with higher performance.

2.2.3.4 Digital Output

Digital Output (DO) is used to interpret a command from the computer and then

output two-level voltages (i.e., high or low) to following devices. For example,

turning on/off lights, enabling heating/cooling systems, or sending digital information

to machinery, the DO can serve as a switch and make these happen in an easy way.

Advantech IAG Training Center (Internal Use Only)


50

Figure 2-24 The Digital Output card can do On/Off control or act as a switch

Table 2-5 shows common spec. items about the DI, including output type, output

direction and power-on status. These will be introduced in detail as follows.

Spec. Item Example


Number of Channels 16 channels or more
Output Type TTL, Isolated DO, Relay (Form A, B, C)
Output Range TTL (0~5V) or Isolated (5~30VDC or higher)
Output Direction Sink or Source
Power-on Status Keep Last Status or Default Status
Data Transfer Mode Software Polling, DMA (PCI-1755 only)
Table 2-5 The specification of Digital Output

(a) Output Type

Advantech IAG Training Center (Internal Use Only)


51

Three output types of the DO are available for users, namely TTL, Isolated

and Relay. As mentioned in Section 2.2.3.3 (a), the voltage level of TTL can be

3.3V or 5V. Consequently, the TTL DO means that the output voltage through DO

channels is 3.3V or 5V (i.e., logic 1) or nothing (i.e., logic 0).

In terms of the isolated DO (IDO), Figure 2-21 can help users understand how it

works. First of all, a Darlington transistor (i.e., next to 2803) usually comes with the

IDO, and an external source (5 ~ 30 V DC or higher) as well as a load (e.g., bulb, fan)

are always required. When the IDO is enabled (i.e., on), the load is driven by the

external source and the current flows from the external source to the IDO (see the left

diagram). When the IDO is off, the load cant be driven, and the free-wheel diode

goes further to release surplus energy stored in the inductive load (see the right

diagram).

Advantech IAG Training Center (Internal Use Only)


52

Figure 2-25 The Isolated DO card can work as a switch to control the load loop circuit

The relay is an electrical switch that can open or close one or many sets of contacts

in an electromagnetic way. It usually comprises a coil of wire surrounding a magnetic

core, a moveable iron armature and a set of contacts. When an electric current goes

over the coil, the magnetic field is generated and forces the armature to leave original

position so as to make or break contacts (i.e., on or off). The relay can switch one or

more poles, each of whose contacts can be thrown by energizing the coil in one of

three ways (see Table 2-6).

Form A Form B Form C

SPST, with default value of NO, SPST, with default value of NC, SPDT, with one NO and one NC, also

Advantech IAG Training Center (Internal Use Only)


53

also called Make contact also called Break contact called Break-before-Make contact
Table 2-6 A relay can be classified to three forms

Normally-Open (NO) means that the contact always stays open until the relay is

activated, whereas Normally-Closed (NC) represents that the contact stays closed

until the relay is driven. Besides, SPST (Single Pole Single Throw) indicates that

there is only one contact which can be connected or disconnected, whereas SPDT

(Simple Pole Double Throw) implies that there are two contacts for different

purposes. The pole with NO is also called Form A, the pole with NC is called

Form B, and the pole with both NO and NC is called Form C.

(b) Output Direction

The output direction means the direction of current flow in the DO. There are two

types of the output direction, that is, Sink and Source. For the sink type DO, the

current flows into the DO channels (e.g., most of Advantech DO cards), whereas for

the source type DO, the current flows from the DO channels (e.g., PCI-1752USO).

Figure 2-22 can give you a clear picture about the difference between the sink and

source type DO. To select sink or source type, please base on the current flow

Advantech IAG Training Center (Internal Use Only)


54

direction of the load you use.

Figure 2-26 The output direction of the Sink and Source type

(c) Power-on Status

The power-on status function allows users to determine what DO value should be

outputted after the system reboots. This value can be the default setting or the same

with the last one before the system restarts. In other words, this function can resume

the DO value from where the DO value leaves off when the system reboots. It is

worth noting that this function helps users get rid of danger caused by wrong action

after unexpected system reset. If users want to make this function available, jumpers

relative to this function need to be correctly set (see Figure 2-23).

Advantech IAG Training Center (Internal Use Only)


55

Figure 2-27 The jumper which can set the power on configuration after hoe reset

2.2.3.5 Counter

The counter is usually used to count the number of events (total count value),

measure the duration of a pulse (pulse width) and calculate the rate of pulses

(frequency). For example, we can use a counter to read how many pulses you input

now, and further use the count value to divide by the time elapse so that we can know

the frequency of input signal.

Advantech IAG Training Center (Internal Use Only)


56

Figure 2-28 The Counter Card can do counting for the events

Common specification about the counter is shown in Table 2-7. Due to the fact

that the counter function is supported by the IC chip 82C54 in most cases, this

section will put a stress on the description about 82C54.

Spec. Item Example


Number of Channels 1 channels or more
Resolution 16-bit or 32-bit (maximal counter value)
Time base 10MHz or higher
Table 2-7 The specification of Counter

The 82C54 is a programmable interval timer/counter chip and can generate a

pacer trigger for AD conversion. It includes three independent 16-bit counters which

Advantech IAG Training Center (Internal Use Only)


57

can count values from 0 to 65535 (i.e., 2 16). Each counter has its own clock input,

control gate and output. Normally, one counter is used as an event counter to calculate

how many events coming from the input channel, the other two can be cascaded

together to form a 32-bit timer/counter. In fact, the 82C54 can support six operating

modes, that is, mode 0 - stop on terminal count, mode 1 - programmable one-shot

pulse, mode 2 - rate generator, mode 3 - square wave generator, mode 4 -

software-triggered strobe and mode 5 - hardware-triggered strobe. For more

information about these six modes, please refer to the datasheet of 82C54.

Advantech IAG Training Center (Internal Use Only)


58

Chapter 3 Product Introduction

After introducing the basic knowledge of the DA&C system, we will instruct you

how to select the DAQ products from Advantech in this Chapter. First of all, the

Naming Rule and the I/O interface will be introduced, and then we will take some

simple examples so that you can know how to select the right products for your

application.

3.1 I/O Product Interface

There are many kinds of products with different I/O interfaces in Advantechs

catalog such as ISA, PCI, USB and CPCI interface. These I/O interfaces can be used

as a communication boundary between the computer and the DAQ card. To know the

Naming Rule of the DAQ cards, we have to understand the concepts of the I/O

interface first.

Advantech IAG Training Center (Internal Use Only)


59

3.1.1 ISA/PC-104 Interface

The 16-bit ISA interface is defined by the IBM PC/AT and it is also called the AT

Bus. Its data transfer rate is only 8.33MHz which is 16.66Mbytes/s (8.33MHz * 2

bytes). And the most significant feature of the ISA interface is that it can not support

PnP (Plug and Play) function, so we have to configure the setting in the software to

make sure it is corresponding to the setting on the hardware. By the way, since the

performance and transfer quality of the ISA bus are not as good as the ones of the PCI

bus, it is replaced by the PCI, AGP, and USB interface gradually.

Figure 3-29 The 16-bit ISA bus

Advantech IAG Training Center (Internal Use Only)


60

As shown in the Figure 3-2, the PCL-818HG (HG means High Gain) is one of

our famous products. It is an ISA card which has AIO and DIO function, and we have

to set the base address or IRQ jumper manually on the card in order to configure the

device.

Figure 3-30 PCL-818HG (100kS/s, 12-bit ISA Multifunction Card)

3.1.2 PCI/PCI-104 Interface

Advantech IAG Training Center (Internal Use Only)


61

The Peripheral Component Interconnect interface which means PCI is the most

common interface in modern computer. It had displaced the ISA bus as the standard

expansion bus. Compare to the ISA bus, there are several superiorities for the PCI

bus. For instance, the data transfer rate for the 32-bit PCI standard bus can be as high

as 133Mbytes/s (33MHz), and the PCI bus can support PnP function so that the

system will configure the device setting automatically. Besides, most of the PCI bus

can support either 5V or 3.3V power suppliers (lower than ISA bus) which we usually

call the Universal Bus. Please refer to the Figure 3-3 to find the difference between

the 5V board and 3.3V board.

Figure 3-31 The Universal Bus and the difference between the 5V board and 3.3V board

We can compare the PCI interface in the Figure 3-4 with the ISA interface in the

Advantech IAG Training Center (Internal Use Only)


62

Figure 3-1. This PCI card is PCI-1710HG which is also a multifunction card and the

HG is short for the High Gain. It means we can use the card which can support

HG function to acquire the voltage which is only mV degree.

3.1.3

Figure 3-32 PCI-1710HG (100kS/s, 12-bit, PCI Multifunction Card)

CPCI Interface

The CompactPCI (CPCI) interface which is defined by the PICMG (PCI

Industrial Computers Manufactures Group) is electrically a superset of desktop PCI

interface with a different physical form factor. The CPCI interface utilizes the

Eurocard form factor popularized by the VME bus (Versa Module European bus) and

Advantech IAG Training Center (Internal Use Only)


63

is usually defined for both 3U (160mm deep * 100mm high) and 6U (160mm deep *

233.35mm high) card sizes.

Figure 3-33 The 3U Socket connector

The data transfer rate for the 32-bit CPCI bus is 133Mbytes/s (33MHz) and can

also support 256 buses as well as the PCI bus. In addition, the CPCI has the staged

power pins for Hot Swap capability, and the excellent shock and vibration resistance

characteristics which can be used in critical applications. Some CPCI cards also have

the user I/O connections on front or rear of the module.

The Figure 3-6 shows the MIC-3714 which is a 4-channel AI card. Since there

has one ADC (Analog-to-Digital Converter) for each channel, this card can acquire

the data simultaneously.

Advantech IAG Training Center (Internal Use Only)


64

3.1.4

Figure 3-34 MIC-3714 (30MS/s Simultaneous 4-ch Analog Input Card)

USB Interface

Up to now, the Universal Serial Bus (USB) interface is becoming popular and has

replaced many legacy varieties of the serial and parallel ports. It is because most of

the USB devices are small and are convenient to carry, and they usually consume little

power. The USB interface can also support PnP and Hot Swap function so that we can

connect the USB device without turning off the computer. Besides, the USB interface

can be easily expanded by using the Hub device and it can connect up to 127 USB

devices on one computer. So far the data transfer rate of the USB interface can be up

to 480Mbit/s (USB 2.0, High-Speed) and it is 40 times faster than the data transfer

Advantech IAG Training Center (Internal Use Only)


65

rate of USB1.1 (12Mbit/s for Full Speed devices, 1.5Mbit/s for Low Speed) around 10

years ago.

Figure 3-35 The USB series Male plug

Advantech has several USB devices, for example, the USB-4716 which is shown

in the Figure 3-8 is a multifunction USB module. Its sampling rate is 200kS/s by high-

speed data acquisition and we can connect up to 16 USB-4716 modules on one

computer.

Figure 3-36 USB-4716 (200kS/s, 16-bit, 16-ch Multifunction USB Module)

Advantech IAG Training Center (Internal Use Only)


66

3.2 Naming Rule

This section will introduce the Naming Rule of the DAQ cards of Advantech.

First of all, please refer to the Figure 3-9 and Table 3-1 which show the Naming Rule

and series products of Advantech ISA interface DAQ cards.

Figure 3-37 Naming Rule of the ISA interface products

Multifunction Card PCL-711B 40 kS/s, 12-bit, 8-ch SE Input ISA Multifunction Card
PCL-812PG 30 kS/s, 12-bit, 16-ch SE Input ISA Multifunction Card
PCL-818HG/HD/L 100 kS/s, 12-bit, 16-ch ISA Multifunction Card

(L: 40 kS/s)
Analog Input Card PCL-813B 25 kS/s, 12-bit, 32-ch SE Isolated Analog Input ISA Card
Analog Output Card PCL-726 12-bit, 6-ch Analog Output ISA Card with 32-ch DI/O
PCL-727 12-bit, 12-ch Analog Output ISA Card with 32-ch DI/O
PCL-728 12-bit, 2-ch Isolated Analog Output ISA Card
Non-Isolated DI/O PCL-720+ 64-ch Digital I/O and Counter ISA Card
PCL-722 144-ch Digital I/O ISA Card

Advantech IAG Training Center (Internal Use Only)


67

Card PCL-724 24-ch Digital I/O ISA Card


PCL-731 48-ch Digital I/O ISA Card
Isolated DI/O Card PCL-725 8-ch Relay and 8-ch Isolated Digital Input ISA Card
PCL-730 32-channel Isolated Digital I/O Card
PCL-733 32-channel Isolated Digital Input Card
PCL-734 32-channel Isolated Digital Output Card
PCL-735 12-ch Relay ISA Card with 16-ch DI/O
Counter Card PCL-836 6-ch, 16-bit Counter/Timer ISA Card
Table 3-8 Advantech ISA interface DAQ cards

The Figure 3-10 and Table 3-2 show the Naming Rule and series products of

Advantech PC-104/PCI-104 interface DAQ cards.

Figure 3-38 Naming Rule of the PC-104/PCI-104 interface products

Multifunction Card PCM-3718H/HG/HO 100 kS/s, 12-bit, 16-ch Multifunction PC/104 Module
Analog Output Card PCM-3712 2-ch Analog Output PC/104 Module
Non-Isolated DI/O PCM-3724 48-ch Digital I/O PC/104 Module
PCM-3753I 96-ch Digital I/O PCI-104 Module
Card
Isolated DI/O Card PCM-3725 8-ch Relay and Isolated Digital Input PC/104 Module
PCM-3730 16-ch Isolated Digital I/O PC/104 Module

Advantech IAG Training Center (Internal Use Only)


68

Counter Card PCM-3780 2-ch Counter/Timer with 24-ch DI/O PC/104 Module
Table 3-9 Advantech PC-104/PCI-104 interface DAQ cards

The Figure 3-11 and Table 3-3 show the Naming Rule and series products of

Advantech PCI interface DAQ cards.

Figure 3-39 Naming Rule of the PCI interface products

Multifunction Card PCI-1710/L/HG/HGL 100 kS/s, 12-bit, 16-ch PCI Multifunction Card
PCI-1711/L 100 kS/s, 12-bit, 16-ch SE Input PCI

Multifunction Card
PCI-1712/L 1 MS/s, 12-bit, 16-ch PCI Multifunction Cards
PCI-1716/L 250 kS/s, 16-bit, 16-ch PCI Multifunction Cards
PCI-1718HDU/HGU 100 kS/s, 12-bit, 16-ch Universal PCI

Multifunction Cards

Advantech IAG Training Center (Internal Use Only)


69

(D: DB-37)
PCI-1741U 200 kS/s, 16-bit, 16-ch Universal PCI

Multifunction Card
PCI-1742U 1 MS/s, 16-bit, 16-ch Universal PCI

Multifunction Card
Analog Input Card PCI-1713 100 kS/s, 12-bit, 32-ch Isolated Analog Input PCI

Card
PCI-1714U 30 MS/s, 12-bit, Simultaneous 4-ch Analog Input

Universal PCI Card


PCI-1714UL 10 MS/s, 12-bit, Simultaneous 4-ch Analog Input

Universal PCI Card


PCI-1715U 500 kS/s, 12-bit, 32-ch Isolated Analog Input

Universal PCI Card


PCI-1747U 250 kS/s, 16-bit, 64-ch Universal PCI Card
Analog Output Card PCI-1720U 12-bit, 4-ch Isolated Analog Output Universal

PCI Card
PCI-1721 12-bit, 4-ch Advanced Analog Output PCI Card

with 16-ch DI/O


PCI-1723 16-bit, 8-ch Analog Output PCI Card with 16-ch

DI/O
PCI-1724U 14-bit, 32-ch Isolated Analog Output Universal

PCI Card
PCI-1727U 14-bit, 12-ch Analog Output Universal PCI Card

with 32-ch DI/O


Non-Isolated DI/O PCI-1735U 64-ch Digital I/O and Counter Universal PCI

Advantech IAG Training Center (Internal Use Only)


70

Card Card
PCI-1737U 24-ch Digital I/O Universal PCI Card
PCI-1739U 48-ch Digital I/O Universal PCI Card
PCI-1751 48-ch Digital I/O and 2-ch Counter PCI Card
PCI-1753/1753E 96-ch Digital I/O PCI Card/96-ch Digital I/O

Extension Card for PCI-1753


PCI-1755 80 MB/s, 32-ch Digital I/O PCI Card
PCI-1757UP 24-ch Digital I/O Low Profile Universal PCI Card
Isolated DI/O Card PCI-1730 32-ch Isolated Digital I/O PCI Card
PCI-1733 32-ch Isolated Digital Input PCI Card
PCI-1734 32-ch Isolated Digital Output PCI Card
PCI-1750 32-ch Isolated Digital I/O and 3-ch Counter PCI

Card
PCI-1752U/USO 64-ch Isolated Digital Output Universal PCI Card

(USO: Source type)


PCI-1754 64-ch Isolated Digital Input PCI Card
PCI-1756 64-ch Isolated Digital I/O PCI Card
PCI- 128-ch Isolated Digital I/O Universal PCI Card

1758UDI/UDO/UDIO
Isolated DI with Relay PCI-1760U 8-ch Relay and 8-ch Isolated Digital Input

Output Card Universal PCI Card with 10-ch Counter/Timer


PCI-1761 8-ch Relay and 8-ch Isolated Digital Input PCI

Card
PCI-1762 16-ch Relay and 16-ch Isolated Digital Input PCI

Card
Counter Card PCI-1780U 8-ch, 16-bit Counter/Timer Universal PCI Card
Table 3-10 Advantech PCI interface DAQ cards

The Figure 3-12 and Table 3-4 show the Naming Rule and series products of

Advantech IAG Training Center (Internal Use Only)


71

Advantech CPCI interface DAQ cards.

Figure 3-40 Naming Rule of the CPCI interface products

Multifunction Card MIC-3716 250 kS/s, 16-bit, 16-ch CPCI Multifunction Card
Analog Input Card MIC-3714 30 MS/s, Simultaneous 4-ch Analog Input CPCI

Card
Analog Output Card MIC-3723/3723R 16-bit, 8-ch Non-isolated Analog Output CPCI

Cards
Non-Isolated DI/O Card MIC-3753/3753R 72-ch Digital I/O CPCI Cards
Isolated DI/O Card MIC-3756 64-ch Isolated Digital I/O CPCI Card
MIC-3758 128-ch Isolated Digital I/O CPCI Card
Isolated DI with Relay Output MIC-3761 8-ch Relay and Isolated Digital Input CPCI Card

Card
Counter Card MIC-3780/3780R 8-ch Counter/Timer CPCI Cards
Table 3-11 Advantech CPCI interface DAQ cards

The Figure 3-13 and Table 3-5 show the Naming Rule and series products of

Advantech IAG Training Center (Internal Use Only)


72

Advantech USB interface DAQ cards.

Figure 3-41 Naming Rule of the USB interface products

Multifunction Card USB-4711A 150 kS/s, 12-bit, 16-ch Multifunction USB Module
USB-4716 200 kS/s, 16-bit, 16-ch Multifunction USB Module
Analog Input Card USB-4718 8-ch Thermocouple Input USB Module with 8-ch

Isolated DI
Non-Isolated DI/O Card USB-4751/4751L 48-ch Digital I/O USB Module

(L: 24-ch)
Isolated DI/O Card USB-4750 32-ch Isolated Digital I/O USB Module
Isolated DI with Relay Output USB-4761 8-ch Relay and 8-ch Isolated DI USB Module

Card
Hub USB-4622 5-port USB 2.0 Hub
Table 3-12 Advantech USB interface DAQ cards

3.3 I/O Selection Guide

To select an Advantech manufactured data acquisition hardware and software for

Advantech IAG Training Center (Internal Use Only)


73

measurement, monitoring and applications control, the first step is to know the source

for what you need. This section will guide and help you to choose components for

your data acquisition system.

Step1: Know your fundamental goal

Decide whether your DA&C system will be used primarily for measurement,

monitoring, control or analysis. Know the data requirements of your process, and

know the number of data collection points in your system. Knowing the required data

collection speed, the sampling rate, the type of measurement, the voltage or current

being produced, the desired accuracy and the output resolution at each data collection

point. Finally, know the timing of events in your system, and any special environment

conditions that exist.

Step2: Hardware selection

Select the hardware required to achieve your fundamental goal. Advantech provides

plug-in boards for Analog-to-Digital, Digital-to-Analog, Digital I/O or Counter needs.

Both ISA and PCI bus products are available. Your hardware selection should be

based on five major criteria:

Advantech IAG Training Center (Internal Use Only)


74

1. Number and types of channels

2. Differential or Single-ended inputs

3. Resolution

4. Speed (Sampling Rate)

5. Software compatibility with hardware

Step3: Signal conditioning modules and terminal boards selection

Most applications require additional accessories which are available as separate

items. These include:

1. Expansion peripherals to add to your system.

2. Cables, signal conditioners and external boxes such as screw terminals or BNC

accessories.

Advantech also provides many kinds of the cables and wiring boards for your

application. Please refer to the Table 3-6 which shows all the signal conditioning

modules and terminal boards in Advantech. For the information of cables, please refer

to the Advantechs catalog.

Advantech IAG Training Center (Internal Use Only)


75

ADAM 3000 Series ADAM-3011 Isolated Thermocouple Input Module


ADAM-3013 Isolated RTD Input Module
(Isolated Signal
ADAM-3014 Isolated DC Input/Output Module
ADAM-3016 Isolated Strain Gauge Input Module
Conditioning Modules)
Relay Module and Carrier ADAM-3854 4-ch Power Relay Module
ADAM-3864 4-ch Solid State Digital I/O Module Carrier Backplane
Backplane
Special Functions Wiring PCLD-780 Screw Terminal Board
PCLD-880 Industrial Wiring Terminal Board with Adapter
Board PCLD-782/782B 16-ch Opto-Isolated DI Board

(B: 24-ch)
PCLD-785/785B 16-ch Relay Output Board

(B: 24-ch)
PCLD-885 16-ch Power Relay Output Board
PCLD-786 8-ch SSR I/O Module Carrier Board
PCLD-7216 16-ch SSR I/O Module Carrier Board
PCLD-788 Relay Scanner/multiplexer Board (CE)
PCLD-789D Amplifier and Multiplexer Board
PCLD-8115 Industrial Wiring Terminal Board with CJC Circuit
PCLD-8710 Industrial Wiring Terminal Board with CJC Circuit
PCLD-8751 48-ch Opto-Isolated Digital Input Board
PCLD-8761 24-ch Opto-Isolated Digital Input/ 24-ch Relay Board
PCLD-8762 48-ch Relay Board
Pin-to-Pin Wiring Board ADAM-3909 DB-9 Wiring Terminal for DIN-rail Mounting
ADAM-3920 20-pin Flat Cable Wiring Terminal for DIN-Rail
ADAM-3925 DB-25 Wiring Terminal for DIN-rail Mounting
ADAM-3937 DB37 Wiring Terminal for DIN-rail Mounting
ADAM-3950 50-pin Flat Cable Wiring Terminal for DIN-rail

Mounting
ADAM-3951 Wiring Terminal Module with LED Indicators for DIN-

rail Mounting
ADAM-3962 DB62 Wiring Terminal For DIN-rail Mounting
ADAM-3968 68-pin SCSI-II Wiring Terminal for DIN-rall Mounting

Advantech IAG Training Center (Internal Use Only)


76

ADAM-3968/20 68-pin SCSI-II to Three 20-pin Wiring Terminal

Module for DIN-rail Mounting


ADAM-3968/50 68-Pin SCSI-II to Two 50-pin Box Header for DIN-rail

Mounting
ADAM-39100 100-pin SCSI-II Wiring Terminal for DIN-rail

Mounting
Table 3-13 Advantech signal conditioning modules and terminal boards

Step4: Software selection

More than any other single factor, software will determine your system start-up

time, as well as its effectiveness, suitability for your application, and ease of

modification. We will introduce Advantechs drivers and the software programming

more detail in Chapter 5.

Three major criteria should determine the choice of software:

1. Operation system used

2. User programming expertise

3. Software compatibility with hardware

Here we take some examples to show you how to select a suitable DAQ card in

Advantech IAG Training Center (Internal Use Only)


77

Advantech.

Example 1: The customer would like to choose a card that has AI/O, DI/O, and

AI/O must support high sampling rate (ex: 100KS/s).

Solution: We can advise the customer to use the PCI-1712 since it is a

multifunction card which has 1MS/s AI and 1MHz AO sampling rate.

Figure 3-42 PCI-1712 (1 MS/s, 12-bit, 16-ch PCI Multifunction Cards)

Example 2: The customer would like to choose a card which could measure

Temperature directly.

Solution: We can recommend the customer to use the USB-4718 which is a

thermocouple module. By using our driver, it can convert the voltage signal from

Advantech IAG Training Center (Internal Use Only)


78

the thermocouple to the temperature. USB-4718 can support up to 7 types

thermocouple input.

Figure 3-43 USB-4718 (8-ch Thermocouple Input USB Module with 8-ch Isolated DI)

Example 3: The customer has a request as shown below.

1. 1000 Isolated DI/O points

2. Only 8 PCI slots on his computer

3. DO status can be kept when the system is hot reset

Solution: Since there are only 8 PCI slots on the customers computer, each PCI

DAQ card must have 125 DI/O channels (1000 points/8 slots). For this reason,

the customer can choose the PCI-1758UDI which has 128 DI/O isolated

Advantech IAG Training Center (Internal Use Only)


79

channels. Therefore, there will be totally 1024 DI/O channels for the customers

application. Besides, PCI-1758UDIO can also support Programmable Power-

Up States function so that the DO status will not changed even if the system is

hot reset.

Figure 3-44 PCI-1758UDIO (128-ch Isolated Digital I/O Universal PCI Card)

Advantech IAG Training Center (Internal Use Only)


80

Chapter 4 Getting Started

Advantech IAG Training Center (Internal Use Only)


81

As we know, the speed of PC is getting faster and faster today, and more and

more users would like to choose PC as the platform for their application. Therefore,

Advantech also develops drivers based on the Windows system for the DAQ products

so that the users can set up their application under Windows system easily. This

Chapter will instruct you how to use the DAQ card of Advantech, how to startup

DAQ cards, the driver installation, and how to test Advantechs DAQ cards in the

Utility.

4.1 Startup of DAQ cards

This section will first introduce the utility Advantech Device Manager. And

then guide you how through the installation of Advantechs DAQ cards which

includes ISA cards (have to install manually), and PCI, USB and CPCI cards (Plug-

and-Play devices) on the computer. We will also instruct you how to use the

Advantech Device Manager with Advantechs DAQ cards to do some tests to check if

the card is workable.

Advantech IAG Training Center (Internal Use Only)


82

4.1.1 Introduction of the Advantech Device Manager

The Advantech Device Manager is a convenient utility which can allow you to

configure the hardware and store the settings in the Windows registry. These settings

will be used when you call the APIs of Advantech 32-bit Device Drivers.

Now we will use USB-4716 as an example to show each function of this utility.

Please follow the steps to install the driver and utility, and learn how to do the test in

the Advantech Device Manager with USB-4716.

1. Please install the driver of USB-4716 and the Advantech Device Manager which

can be found in the driver CD.

Advantech IAG Training Center (Internal Use Only)


83

Figure 4-45 Install Driver and Advantech Device Manager from the driver CD

2. You can also download the files from the Advantech Support & Download

website.

http://support.advantech.com.tw/Support/SupportCategoryView.aspx?ID=1-2MLJZA

Advantech IAG Training Center (Internal Use Only)


84

Figure 4-46 The Advantech Support& Download website

Please search the USB-4716 product and you can find the Universal 32-bit

Windows driver in the drivers tab.

http://support.advantech.com.tw/Support/DownloadSearchByProduct.aspx?

keyword=USB-

4716&ctl00_ContentPlaceHolder1_EbizTabStripNoForm1_Tab=Driver

Advantech IAG Training Center (Internal Use Only)


85

Figure 4-47 The drivers page of USB-4716

Then please download the Advantech Device Manager and the driver of USB-

4716 from the website.

Advantech IAG Training Center (Internal Use Only)


86

Figure 4-48 Download the Advantech Device Manager and the driver of USB-4716

from the website

3. After the installation, you can connect USB-4716 to the computer and you will

see the USB-4716 in the Installed Devices list in the Advantech Device

Manager. The Device Number is used to specify the device in the software

program while the BoardID is used to identify cards of the same type. The

Advantech IAG Training Center (Internal Use Only)


87

Control Button is to let you configure the device setting, test the basic functions,

and remove the device.

Figure 4-49 Install the USB-4716 in the Advantech Device Manager

4. Click the Setup button and you can set the driver default device property

values, these values will be saved in system. The device properties will be

referenced by the device driver functions.

BoardID: USB device has a virtual Board ID. It is the ID of device. When

Advantech IAG Training Center (Internal Use Only)


88

there are multiple USB devices connected to Host, we can use this ID to identify each

device. This ID exists in EPROM of USB device, so it will not disappear or change

when the module is powered off. It can be set form 0~15 (Default is 0). Please note if

multi-devices are connected to the Host, each device must have different Board ID

or Host will fail to find the device. And we can find the device with specified Board

ID via this Locate button.

AI Channel Configuration: Set the Single-Ended or Differential Configuration

for the selected channel.

AO Channel 0/1 Ref: Set the D/A reference voltage for the A/O output channel.

Calibration: Do the Auto-Calibration for the AI or AO.

Advantech IAG Training Center (Internal Use Only)


89

Figure 4-50 Configure the USB-4716

5. After the Device Configuration, we can demonstrate the hardware functions by

clicking the Test button.

6. First of all, please click on the Analog input tab in the test utility and the analog

input test panel will appear as shown in the Figure 4-7. Select the range for each

channel in the Input range field. Configure the sampling rate by dragging the

scroll bar. Switch the channels with the up or down arrow.

Advantech IAG Training Center (Internal Use Only)


90

Figure 4-51 Analog input tab

7. Click on the Analog output tab to switch to the analog output test panel as

shown in the Figure 4-8. The panel allows the sine, square, and triangle

waveforms to be outputted automatically, or a single value to be outputted

manually. Configure the waveform frequency by dragging the scroll bar. Switch

the output channels with the up or down arrow.

Advantech IAG Training Center (Internal Use Only)


91

Figure 4-52 Analog output tab

8. Click on the Digital input tab to switch to the digital input test panel. The up or

down arrow may be used to switch the digital input channel.

Advantech IAG Training Center (Internal Use Only)


92

Figure 4-53 Digital input tab

9. Click on the Digital output tab to switch to the digital output test panel. By

pressing the buttons on the panel, the desired values may be outputted to the

corresponding ports. The up or down arrows may be used to switch the digital

output channel.

Advantech IAG Training Center (Internal Use Only)


93

Figure 4-54 Digital output tab

10. Click on the Counter tab to switch to the counter test panel. The panel provides

event counting and pulse output functions. The pulse frequency may be

configured by scrolling the scroll bar. The counter channel may be switched by

using the up or down arrow.

Advantech IAG Training Center (Internal Use Only)


94

Figure 4-55 Counter tab

4.1.2 Startup of ISA cards

For the ISA cards, we take PCL-818L (40 kS/s, 12-bit, 16-ch ISA Multifunction

Card) as an example.

1. Install the Advantech Device Manager and Drivers from the driver CD or

Advantech website.

2. After the installation, we have to check the system resource to install the PCL-

Advantech IAG Training Center (Internal Use Only)


95

818L manually since ISA cards (PCL and PCM series) can not support Plug-and-

Play function.

3. First of all, please check the Base I/O Address in the Windows Device Manager.

You can see that the address 300-376H is not shared by other add-on devices in

the Figure 4-12.

Advantech IAG Training Center (Internal Use Only)


96

Figure 4-56 Check the Base I/O Address in the Device Manager

4. Please check the Interrupt Request (IRQ) in the Windows Device Manager. You

can see that the IRQ 7 is not shared by other add-on devices in the Figure 4-13.

Advantech IAG Training Center (Internal Use Only)


97

Figure 4-57 Check the IRQ in the Device Manager

5. Please check the DMA channel in the Windows Device Manager. You can see that

the DMA channel 1 is shared by other add-on devices in the Figure 4-14.

Advantech IAG Training Center (Internal Use Only)


98

Figure 4-58 Check the DMA channel in the Device Manager

6. Please refer to the hardware manual of PCL-818L to set the jumper and switch on

the PCL-818L card. For example, the Figure 4-15 shows how to set the Base I/O

Address.

Advantech IAG Training Center (Internal Use Only)


99

Figure 4-59 Set the Base I/O Address of PCL-818L

7. Scroll down the List of Supported Devices and select the PCL-818L to be

installed. Click the Add button to install the PCL-818L in the Advantech

Device Manager manually.

Advantech IAG Training Center (Internal Use Only)


100

Figure 4-60 Add the PCL-818L in the Advantech Device Manager

8. After clicking the Add button, a configuration dialog box will load for the

specified device as shown in the Figure 4-17. Please set the device configuration

in the Advantech Device Manager. Please also note the software setting should be

corresponding to the hardware setting. And the resource (Base Address, IRQ and

DMA channel) can not be shared by other add-on devices.

Advantech IAG Training Center (Internal Use Only)


101

Figure 4-61 Set the device configuration in the Advantech Device Manager

9. After configuring the device, click the OK button and the device will be shown

in the Installed Devices field as shown in the Figure 4-18. Then we can do some

tests in the Advantech Device Manager.

Advantech IAG Training Center (Internal Use Only)


102

Figure 4-62 Test the functions of PCL-818L

10. As shown in the Figure 4-19, the AI0 will read 2.5V by inputting a 2.5V DC

voltage signal to the AI0 channel. You can also do the test with other functions

(AO, DIO and Counter) in the Advantech Device Manager.

Advantech IAG Training Center (Internal Use Only)


103

Figure 4-63 Test the AI function of PCL-818L

4.1.3 Startup of PCI, USB and CPCI cards

For the PCI, USB and CPIC cards, we do not need to install the devices

manually since they can all support Plug-and-Play function. And here we take PCI-

1710HG (100 kS/s, 12-bit, 16-ch PCI Multifunction Card) as an example.

1. Install the Advantech Device Manager and Drivers from the driver CD. Or you

can also download the files from the Advantech Support& Download website.

Advantech IAG Training Center (Internal Use Only)


104

http://support.advantech.com.tw/support/DownloadSRDetail.aspx?SR_ID=1-O1VSR

2. After the installation of the driver, we can plug the PCI-1710HG card on the PC

directly and the hardware will be installed after the PC boots or re-scans the

devices in Windows Device Manager. All the bus-related configurations (Ex. Base

I/O address) will be handled by the Plug-and-Play function automatically.

Figure 4-64 Setup and test the functions of PCI-1710HG

3. In the Setup, you can set the Device Configuration such as the A/D channels

Advantech IAG Training Center (Internal Use Only)


105

configuration and the D/A voltage reference.

Figure 4-65 Set the Device Configuration

Click the Options button, a window will pop up and you can select the expansion

board for the extended application (Ex. use PCLD-8710 to measure the temperature).

Advantech IAG Training Center (Internal Use Only)


106

Figure 4-66 Set the expansion board

On the other hand, you can do the Auto-calibration of the AI can AO functions by

clicking the Calibration button. For more information about the calibration, please

refer to the hardware manual.

Figure 4-67 Do the Auto-calibration

4. By testing, we can set the analog output value in the AO tab. Here we set the

output value as 2.5VDC as show in the Figure 4-24.

Advantech IAG Training Center (Internal Use Only)


107

Figure 4-68 Set AO output value

5. Then connecting AO0 channel to AI0 channel directly, you can see the AI0 will

read 2.5V as show in the Figure 4-25.

Advantech IAG Training Center (Internal Use Only)


108

Figure 4-69 Test the AI function of PCI-1710HG

6. Now we do the DIO test. In the beginning, you can see all the DI statuses are

High as shown in the Figure 4-26. It is because there are pull-up resistors in the

DI channels of PCI-1710HG.

Advantech IAG Training Center (Internal Use Only)


109

Figure 4-70 The default DI status of PCI-1710HG

By connecting the DO0 channel to the DI0 channel, the DI0 status will become

Low since the DO0 status is Off which means there is no voltage output.

Advantech IAG Training Center (Internal Use Only)


110

Figure 4-71 Test the DI function of PCI-1710HG

Whenever you On the DO0 button in the DO tab, the DI status will become

High again since the DO0 will output a 5V voltage signal.

Advantech IAG Training Center (Internal Use Only)


111

Figure 4-72 Test the DO function of PCI-1710HG

7. Finally, we can test the counter function by inputting a TTL signal to the counter

of PCI-1710HG. As shown in the Figure 4-29, the counter starts to count by the 1

KHz TTL signal.

Advantech IAG Training Center (Internal Use Only)


112

Figure 4-73 Test the Counter function of PCI-1710HG

4.2 The introduction of WaveScan2.0

WaveScan2.0 is another Advantechs useful utility which makes it easier for the

user to acquire, observe and store data. This utility is based on the ActiveDAQ GUI

control and the ActiveDAQ Pro Device control. With data acquisition and data display

functions provided by the controls, WaveScan2.0 can achieve the purpose of real-time

monitoring and history checking. In this section, we will instruct you how to use the

Advantech IAG Training Center (Internal Use Only)


113

WaveScan2.0 utility and will also take an example for your reference. For the

ActiveDAQ Pro device and GUI controls, we will introduce them in the Chapter 5.

1. Please refer to the Figure 4-30 for the main interface and interface elements of the

WaveScan2.0 first.

Figure 4-74 User interface layout of the WavsScan2.0

1. The Graph display area is used to show the acquired AI or DI data.

2. The Popup menu contains various mouse modes: XPan, YPan and etc.

3. Y coordinate of DI plot is the sum: DI port * 8 + DI Channel + 0.66 * [value

Advantech IAG Training Center (Internal Use Only)


114

is high]

4. The Plot data line style is used to show different curve styles for AI or DI

data of different channels.

5. The History Playback GroupBox contains controls related with the playback

of historical data. The definition of these controls is consistent with the

definition of the Playbar of media players.

6. The Start button is used to begin or stop data acquisition. The HistoryMode

button is used to switch between data acquisition mode and historical data

playback mode.

7. The Device GroupBox contains the button for opening the device

configuration page. It also contains the storage options for AI/DI data.

8. The Graph GroupBox contains the button for adjusting the resolution of the

area and the button for opening the Graph configuration page.

9. The Signal GroupBox is used to select the data source between AI data, DI

data and historical data.

10. The Exit button is used to terminate the program.

2. By clicking the Setting button in the Device GroupBox on the main interface, a

window will pop up and you can set the FAI (Fast Analog Input), soft AI and/or

DI configuration here.

Advantech IAG Training Center (Internal Use Only)


115

For the FAI setting, please refer to the Figure 4-31. You can click the

SelectDevice button to select a device. The start channel, channel count and data

count should be set. The return data type should be set to analog or digital. If Cyclic is

selected, then AI operation will function cyclically. External triggering can be selected

in the drop-down box of PacerSource for acquisition cards that support external

PacerSource. The user can specify advanced properties in the Trigger Setting

GroupBox. When fast AI is used, if data loss occurs, then the user should increase the

DataCount or reduce the SampleRate correspondingly. When the configuration is

completed, click the OK button.

Advantech IAG Training Center (Internal Use Only)


116

Figure 4-75 FAI Configuration

For the Soft AI and/or DI setting, please refer to the Figure 4-32. In the Soft AI

function, you only need to set the start channel, the channel count and the acquisition

interval for AI operation. While in the Soft DI function, you only need to set the

device for DI operation, the DI channel for acquisition and the shared acquisition

interval for DI and AI operation.

Advantech IAG Training Center (Internal Use Only)


117

Figure 4-76 Soft AI and/or DI Configuration

3. For the Gain Setting, please click the SetRange button to open the

RangeSetting dialog box. In the dialog box, you can set the gain of each channel

by using the control in the InputRange GroupBox and set each channel to single-

ended or differential by using the control in the SignalConnection GroupBox.

Advantech IAG Training Center (Internal Use Only)


118

Figure 4-77 Gain Setting

For temperature measurement cards (Ex. USB4718, PCI1710HG + PCLD-8710

and PCI1718HG + PCLD-8710 are supported; for other cards, the AI | Thermo

GroupBox will be disabled.), channels can be set for temperature data acquisition.

You can set the current channel to acquire temperature data by clicking Thermo in the

AI | Thermo GroupBox and then the ExpChan (reserved) and TCType (thermocouple

type) should also be set.

Advantech IAG Training Center (Internal Use Only)


119

Figure 4-78 Thermo Setting

4. Now we will use the Advantech DEMO Board as an example to show how to use

the WaveScan2.0 to acquire and store data. Please select the Advantech DEMO

Board in the Supported Devices in the Advantech Device Manager as shown in

the Figure 4-35.

Advantech IAG Training Center (Internal Use Only)


120

Figure 4-79 Add the Advantech DEMO Board

After clicking the Add button, a window will pop up to let you set the Base I/O

Address as shown in the Figure 4-36.

Advantech IAG Training Center (Internal Use Only)


121

Figure 4-80 Set the Base I/O Address of the Advantech DEMO Board

5. Then please click the Setting button in the Device GroupBox to open the Setting

page. And you can just follow the setting as shown in the Figure 4-32. When the

setting is complete, click the AI or DI switch in the Signal GroupBox. The

software triggering acquisition will be enabled when the Start button is clicked.

6. To store historical data, select the corresponding check box in the Device

GroupBox. When the acquisition is complete, the data can be saved.

Advantech IAG Training Center (Internal Use Only)


122

Figure 4-81 Start the AI acquisition and store the historical data

7. The WaveScan2.0 can store temporary data when storing data during the

acquisition is requested. When the acquisition is complete, the WaveScan2.0 will

store data to the specified path and folder and then a file with the suffix .wsp

(WaveScan2.0 project) will be generated. You can open this file for history

playback. Please note the data loss will occur if the data has not been stored before

the next acquisition.

Advantech IAG Training Center (Internal Use Only)


123

Figure 4-82 SaveAs Dialog Box

8. For historical data playback, you should click the History button in the Signal

GroupBox and select the file from the file dialog box.

Figure 4-83 Historical File Interface

Advantech IAG Training Center (Internal Use Only)


124

9. The file is played by the control in the PlayBack GroupBox. The buttons indicates

start/pause, accelerate and stop respectively. You can also adjust the playing speed

and process by clicking on the playing speed and playing process sliders on the

left.

Figure 4-84 Show the historical data

10. The Convert button is used to convert historical binary data to text data in order

for the user to import the data into Excel.

Advantech IAG Training Center (Internal Use Only)


125

Figure 4-85 Text Interface

Advantech IAG Training Center (Internal Use Only)


126

Advantech IAG Training Center (Internal Use Only)


127

Chapter 5 Software Introduction

To have a complete DA&C system, we have to learn not only the basic

knowledge of DA&C modules but also how to use the driver for the programming.

Advantech provides several drivers for the user to develop their programming on their

application, such as Advantech Device Driver, ActiveDAQ Pro driver, LabViewDAQ

driver and so on. This Chapter will introduce the Advantech drivers first, and then

instruct you to do the programming for the advanced lesson.

5.1 Advantech Device Driver

The Advantech Device Driver which also called 32-Bit DLL driver is the base of

all other drivers in Advantech. It means no matter what software program we want to

use for controlling the hardware, it has to be commanded through the Advantech

Device Driver. As shown in the Figure 5-1, different users will use different software

programs for their different applications, for example, Visual C++, Visual Basic,

Advantech IAG Training Center (Internal Use Only)


128

Delphi, Visual Studio .Net, Matlab, LabView or Advantechs GeniDAQ. We develop

different kinds of drivers for these software programs so that the user can control the

DAQ cards easily. But all these drivers are relative to the Advantech Device Driver, so

it is a MUST for Advantechs DAQ cards. And so far the Advantech Device Driver

can support WinXP and Vista operation systems.

Figure 5-86 Comprehensive software support is based on 32-Bit DLL drivers

For the features of the Advantech Device Driver, it can provide comprehensive

functions to maximize the hardware's performance. The powerful programming API

functions are available in a variety of programming environments and languages, and

Advantech IAG Training Center (Internal Use Only)


129

same programs can be easily adopted by different cards with the same functions. This

driver can support high-speed functions that utilize DMA or interrupt for data

acquisition. The DMA transferring of data uses less CPU time and speeds the data

transfer rate. These functions are used to transfer large amounts of data at high speed.

And the Advantech Device Driver can also support event handling functions. Users

can get the status of data transferring and acquisition when events are signaled within

the device. Manual status check is not necessary. This improves the system efficiency.

Besides, except the installation of the Advantech Device Driver while using the

DAQ card, we also have to install the Advantech Device Manager to let the device

work since it includes the ADSAPI32.DLL file. Please refer to the Figure 5-2, the

ADSAPI32.DLL file is a bridge between the Advantech Device Driver and other

drivers in Advantech.

Advantech IAG Training Center (Internal Use Only)


130

Figure 5-87 API is controlling DAQ cards through ADSAPI32.DLL

5.1.1 Examples of the Advantech Device Driver

We provide a lot of examples and sample codes for Visual C, Visual Basic, Borland

C and Delphi so that the user can develop the application by programming more

easily. You can find the All_Examples file in the Examples folder in driver CD, or

you can also download it from the website.

http://support.advantech.com.tw/support/DownloadFile.aspx?File_Id=1-

2NE5PI&Solution_ID=1-

94DDU&filename=All_Examples.zip&utm_campaign=All_Examples.zip&utm_sour

ce=support.advantech.com.tw&utm_medium=Download

Advantech IAG Training Center (Internal Use Only)


131

Figure 5-88 Examples for VC, VB and Delphi

After the installation, you will find the libraries and examples in the folder as

shown in the Figure 5-4.

Figure 5-89 Examples and Libraries for VC, VB and Delphi

Advantech IAG Training Center (Internal Use Only)


132

To know how to build an application by sing the Advantech Device Driver in VC,

VB and Delphi, please refer to the Advantech Device Drivers Manual.

Figure 5-90 Getting started with Advantech Device Driver

5.2 Advantech ActiveDAQ Pro Driver

The ActiveDAQ Pro driver is a collection of OCX (ActiveX) controls for

performing I/O operations within any compatible ActiveX control container, such as

Advantech IAG Training Center (Internal Use Only)


133

Visual Basic, Delphi and .Net environment, etc. Compared to the Advantech Device

Driver, you can easily perform the I/O operations through properties, events and

methods with the ActiveDAQ Pro driver. And you can also perform versatile I/O

operations to control your Advantech DAQ devices. But please note the ActiveDAQ

Pro driver is still based on the Advantech Device Driver as shown in the Figure 5-6.

Therefore, you still have to install the Advantech Device Driver before using the

ActiveDAQ Pro driver.

Figure 5-91 The structure of the ActiveDAQ Pro driver

The ActiveDAQ Pro package contains the following components:

Advantech ActiveDAQ Pro Device Control: Enumerate all Advantech

devices, direct I/O operation.

Advantech ActiveDAQ Pro AI Control: Retrieve data from Advantech AI

device.

Advantech IAG Training Center (Internal Use Only)


134

Advantech ActiveDAQ Pro AO Control: Export data to Advantech AO

device.

Advantech ActiveDAQ Pro Digital I/O Control: Digital I/O operation.

Advantech ActiveDAQ Pro Thermo Control: Retrieve temperature by

thermocouple measurement.

Advantech ActiveDAQ Pro Counter Control: Counter input signal.

Advantech ActiveDAQ Pro Pulse Control: Pulse signal output.

You can use these ActiveX controls in any development tool that supports them,

including Microsoft Visual C++, Microsoft Visual Basic, Borland C++ Builder,

Borland Delphi and Microsoft Visual Studio .NET.

5.2.1 Features of the ActiveDAQ Pro Driver

In the ActiveDAQ Pro driver, efforts have been made to improve on the technical

aspects and to provide a clear-cut mode of operation, as explained in the following

summary.

1. Graphic User Interface Control Components

Advantech IAG Training Center (Internal Use Only)


135

The Advantech ActiveDAQ Pro GUI control collection consists of abundant of

Graphic User Interface (GUI) control components, which enable users to conveniently

and quickly build graph display modules for data acquisition so as to supervise the

evolution of the object. The ActiveDAQ Pro GUI control collection also helps users

easily develop prototype vision applications in an interactive environment without

programming. These control components include:

Button Control: It offers various display styles (2D and 3D) and is a

Boolean control that displays an on or off state (True or False).

Figure 5-92 Button control

Graph Control: This control provides abundant graph display functions,

which enable the user to displays data of various sources simultaneously.

Knob Control: It is a circular data controlling control that provides various

Advantech IAG Training Center (Internal Use Only)


136

graph styles and can be used to display one or more values on the same

interface.

LED Control: This control provides data display and editing functions with

the seven-segment nixie tube mode. After the Formatstring has been chosen

or defined by the user, the displayed value of the control will be adjusted

automatically according to the FormatString and displayed in the text edit

box.

Figure 5-93 Graph, Knob and LED control

Intensity Control: It offers two-dimensional display and simple

interpolation for scattered 3D data points so that the user can conveniently

check the intensity variation trend of scattered 3D data points.

Advantech IAG Training Center (Internal Use Only)


137

Figure 5-94 Intensity control

NumEditor Control: This control provides the user with the functions of

data displaying and editing. After the Formatstring has been chosen or

defined by the user, the values of the control will be adjusted automatically

according to the FormatString and displayed in the text edit box.

Advantech IAG Training Center (Internal Use Only)


138

Figure 5-95 NumEditor control

Slider Control: It is a linear data controlling control that provides various

graph styles. A Slider control can be used to set or display one or more

values.

Advantech IAG Training Center (Internal Use Only)


139

Figure 5-96 Slider control

2. Supports All Advantech DAQ Devices With High Speed Functions

The ActiveDAQ Pro driver can fully support all Advantech DAQ cards and

functions with complete high speed data acquisition, including AI, AO, DIO and

counter cards. These high speed functions are preformed by interrupt and DMA data

transfer which were previously excluded.

3. Straightforward User Interface and Independent Operation Of Controls

The ActiveDAQ Pro driver has become less-hardware dependent and it has relied

more on intuition during the user interface. The target of this driver is to decrease the

Advantech IAG Training Center (Internal Use Only)


140

development difficulties. It has become easier for both entry level and advanced level

users to manage. And the ActiveDAQ Pro driver can offer total independent control

operation, needing no support from other existing controls.

4. Easy-to-use Property Sheet Interface For Configuring Controls

The property page will offer selections which will give easy access to all settings

eliminating unnecessary programming. Programming will only be required in

specialized situations. Besides, physical properties like voltage, current and frequency

can be directly applied by the user and will automatically be reassigned to the data

needed by GainCode and sampling rate. Making these changes has ensured that the

ActiveDAQ Pro driver has become much more user friendly.

5. Default Settings For Immediate Execution

Proper default settings have been added to all methods and properties. That

means quicker execution for the user, which will offer a prompt response.

6. Properties And Parameters Are Chosen Automatically

When the user opts for some specific methods in the ActiveDAQ Pro driver, it

Advantech IAG Training Center (Internal Use Only)


141

can result automatically in appropriate properties and parameters. For example, the

ActiveDAQ Pro control can automatically determine an appropriate data transferring

method to perform the data acquisition. (Software, interrupt or DMA transfer)

7. Supports All Widely Known Development Platforms

The ActiveDAQ Pro driver can support Microsoft Windows 2000/XP and Vista

operation system. And it can support all widely known development platforms based

on ActiveX technology. These platforms include Microsoft Visual Basic, Visual C++,

Visual Basic.Net, Visual C#, Borland C++ Builder and Delphi.

5.2.2 Examples of the ActiveDAQ Pro Driver

For the installation of the ActiveDAQ Pro driver, please find the file in the driver

CD, or you can also download it from the website.

http://support.advantech.com.tw/support/DownloadSRDetail.aspx?SR_ID=1-29WPJY

Advantech IAG Training Center (Internal Use Only)


142

Figure 5-97 ActiveDAQ Pro driver

After the installation, you can find the examples of the ActiveDAQ Pro Device

and GUI controls in the folder as shown in the Figure 6-12. We provide examples for

VB.Net, C#, Delphi, etc. for the users reference.

Figure 5-98 Examples for the ActiveDAQ Pro Device and GUI controls

Advantech IAG Training Center (Internal Use Only)


143

To know how to add or use the ActiveDAQ Pro ActiveX controls in different

applications, please refer to the Advantech ActiveDAQ Pro Control Help.

Figure 5-99 Add the ActiveDAQ Pro controls in application

5.3 Advantech LabView Driver

LabView, which is the short for Laboratory Virtual Instrument Engineering

Workbench, is developed by the NI (National Instruments) Corporation. It is a

visually-oriented programming development tool, and each program is called VI

Advantech IAG Training Center (Internal Use Only)


144

(Virtual Instrument). Every VI in LabView has three main parts; the first one is the

front panel, the second is the block (or wiring) diagram window and the last one is the

Icon & connector.

In Advantech, we provide two LabView drivers, LabView and LabViewDAQ, for

the user to control Advantech DAQ cards in the LabView program. These two drivers

are totally different, but they can both work with LabView version 7, 7.1, 8.0 or

higher. And they can both form an interface between the Advantech Device Driver,

which contains all the relevant functions to control the DAQ cards, and the LabView

software. It means the Advantech LabView drivers can form a VI in the LabView

package, which enables other applications to be used in conjunction with the DAQ

cards.

Advantech IAG Training Center (Internal Use Only)


145

Figure 5-100 Through the structure, Advantech LabView driver becomes NI Style

For the installation of the Advantech LabView Drivers, please find the files in the

driver CD or download them from the website.

http://support.advantech.com.tw/support/DownloadSRDetail.aspx?SR_ID=1-29WTFD

This section will introduce these two drivers respectively.

Advantech IAG Training Center (Internal Use Only)


146

Figure 5-101 LabView and LabViewDAQ drivers

5.3.1 LabView Driver

The Advantech's 32-bit LabView driver is designed to integrate Advantech DAQ

Cards with the LabView software. This driver feature has both high speed and normal

speed data acquisition functions, and provides two different set of interfaces for users.

One is Easy I/O VIs for ease-to-use, and the other is Advanced I/O VIs for

complex applications. You can find these VIs in the User Libraries in the LabView

program after the installation of the LabView driver.

Advantech IAG Training Center (Internal Use Only)


147

Figure 5-102 VIs for the LabView driver

Besides, we also provide a lot of LabView examples which includes fast AI, fast

AO, PortIO, slow IO and other aspects for the users to develop their application

quickly. You can find these examples in the folder as shown in the Figure 5-18. For

more information, please refer to the LabView Drivers Manual.

Advantech IAG Training Center (Internal Use Only)


148

Figure 5-103 Examples for the LabView driver

5.3.2 LabViewDAQ Driver

The Advantech LabViewDAQ driver is the latest generation of LabView driver.

And its can be categorized in to three types:

1. Easy VIs perform simple operations. You can run these VIs from the front

panel or use them as subVIs in basic applications. They provide a basic, convenient

interface with only the most commonly used inputs and outputs, such as AI, AO, DIO,

and Counter/Timer functions. They are actually composed of Intermediate VIs. Unlike

Intermediate VIs, Easy VIs automatically alerts you to error with a dialog box that

asks you to stop the execution of the VI or to ignore the error.

Advantech IAG Training Center (Internal Use Only)


149

2. Intermediate VIs have more hardware functionality and efficiency in

developing applications than Easy VIs. Utility VIs consist of convenient groupings of

Intermediate VIs. Intermediate VIs are used in most applications. Each Intermediate

and Advanced VI contains an error in input cluster and an error out output cluster,

which give you more control over error handling than Easy VIs. With each VI, you

can check for errors or pass the error cluster to other VIs. In each data acquisition

palette, for Intermediate VIs, there are calling flows available for guidance.

3. Utility VIs are also intermediate-level VIs. They are for situations where you

need more functionality control than the Easy I/O VIs provide but want to limit the

number of VIs you call.

For using the LAbViewDAQ VIs, please install the driver which can be found in

the driver CD, or you can also download it from the website.

http://support.advantech.com.tw/support/DownloadSRDetail.aspx?SR_ID=1-29WTFD

After the installation, you can find the LabViewDAQ VIs by right-click on the

block diagram window in the LabView program. And then select Fucntion ->

All Functions -> User Libraries -> Advantech DAQ as shown in the Figure 6-

Advantech IAG Training Center (Internal Use Only)


150

19.

Figure 5-104 LabViewDAQ VIs

Furthermore, it is deserved to mention that the LabViewDAQ VIs can replace NIs

DAQ VIs. This function was made especially for the users who use NI DAQ card and

have developed their own application in LabView before. In the past, these users must

have to modify their LabView program if they want to replace the NI DAQ card with

the Advantech DAQ card. But now, they can just use the LabViewDAQ VIs to replace

the NI VIs since the pin assign of the LabViewDAQ VI is identical to NI DAQ VI.

Therefore, by replacing the VI, existing programs based on NI DAQ driver can be

used to control Advantech DAQ card.

Advantech IAG Training Center (Internal Use Only)


151

To know how to replace NI DAQ VIs, we make a demo video which can be

available on the website to show you the process. Generally, all examples that NI

DAQ driver provides can be replaced in the same manner.

http://support.advantech.com.tw/support/KnowledgeBaseSRDetail.aspx?SR_ID=1-

1Y5SWB

Here we take an example for your reference.

1. Find NI DAQ Cont Acq&Chart (buffered) example in the route as below.

C:\Program Files\National Instruments\LabVIEW 8.0\examples\daq\anlogin

Figure 5-105 NI Cont Acq&Chart (buffered) example

2. While running with the Advantech DAQ card (Ex. PCI-1714), there will be an

Error which means it can not support the hardware.

Advantech IAG Training Center (Internal Use Only)


152

Figure 5-106 The NI VIs can not support the Advantech hardware

3. Then please right click the VI and replace it by LabViewDAQ VI. Please also

watch out the Device Number connection of AI_Start.

Advantech IAG Training Center (Internal Use Only)


153

Figure 5-107 Replace NI VIs with Advantech LabViewDAQ VIs

4. Finish the replacement of all VIs.

Advantech IAG Training Center (Internal Use Only)


154

Figure 5-108 Finish the replacement of all VIs

5. Running again, you can find that this example can already work with the

Advantech DAQ card.

Figure 5-109 The example can work without problem

5.4 Programming (Advanced)

Advantech IAG Training Center (Internal Use Only)


155

So far, we have already introduced all the basic knowledge for the Advantech

DA&C system. Now we want to instruct you to know how to control the Advantechs

DAQ cards by programming. And since most of the users would like to acquire their

data in a High Speed which also means High Sampling Rate, our driver provides

some API (Application Program Interface) to support the INT and DMA functions

which are introduced in the section 2.3.2.1. By using these API, the user can achieve

the purpose of High speed analog data acquisition. So in this section, we will not

only introduce the programming of the software polling, but will also specially

introduce the INT and DMA functions to let you know how they work by

programming. And finally, we will guide you to complete a project for the

ActiveDAQ Pro Driver. After this, we believe you will be more familiar with our

driver and programming.

5.4.1 AI Transferring by Software Polling

By referring to the Figure 5-25 or in the Drivers Manual, we can find all the

functions we can use to trigger the data conversion by software command. The driver

provides two kinds of functions. One is for single channel reading such as

DRV_VoltageIn, and the other is for multiple channels reading such as

Advantech IAG Training Center (Internal Use Only)


156

DRV_MAIVoltageIn. Both kinds of operations acquire the data only once. To

sample multiple data periodically by these functions, a software timer can be used to

call the functions periodically.

Figure 5-110 The functions for Software Polling

Now please refer to the AD_SOFT examples for VC program which you can find

in the route: C:\Program Files\Advantech\Adsapi\Examples\VC\AD_SOFT.

The programming is easy. First of all, we have to use the DRV_DeviceOpen to

Advantech IAG Training Center (Internal Use Only)


157

open the corresponding installed device by its device number (DeviceNum) and return

the DriverHandle for later operations. Please note this function must be called before

any other methods that perform I/O operations. Then we can use the

DRV_DeviceGetFeatures and DRV_AIConfig to retrieve the device's features

and configures an AI channels input voltage range by setting the corresponding

GainCode on the DriverHandle specified device. Please refer to the corresponding

Hardware Manual for detailed information on input voltage range and the

corresponding GainCode.

Advantech IAG Training Center (Internal Use Only)


158

Figure 5-111 Open the device and retrieve/configure the devices features

After that, we can use a timer to read back the current voltage from an AI channel

unceasingly by DRV_AIVoltageIn on the device indicated by the DriverHandle.

Please remember to use the DRV_DeviceClose to close the DriverHandle specified

device after the operation of any function. The user must call this function to release

the resources.

Advantech IAG Training Center (Internal Use Only)


159

Figure 5-112 Read the current voltage from AI channel

You can refer to the flow chart as show in the Figure 5-28. The DRV_AIConfig

configures the input range for the specified channel. If the input range needs to be

changed at runtime, use the DRV_AIConfig function again. The

DRV_AIVoltageIn function reads the voltage of input channels. The Device Drivers

also provide a binary data reading function, DRV_AIBinaryIn. The functions for

multiple channel sampling are similar to those for single data reading, except the input

channel is not limited to one.

Advantech IAG Training Center (Internal Use Only)


160

Figure 5-113 The flow chart for AI reading by software polling

5.4.2 Fast AI Transferring

Except for the software polling, all the other analog sampling methods, including

DMA, bus-master DMA, interrupt etc., are identified as FAI (Fast Analog Input)

functions. The operation modeling and flow control in all kinds of FAI sampling

methods are similar.

1. Initiate a sampling data buffer

In FAI data operation, the size of buffer is not determined by the FIFO size.

However, before you engage sampling, you must set up your sampling count, i.e. the

Advantech IAG Training Center (Internal Use Only)


161

data count that you want, while it is also the size of sampling data buffer in our

example. Commonly we need to create a sampling data buffer first and pass the

pointer to the driver for later acquisition. The buffer is created by the user, commonly

according to your sampling count, but used in the kernel mode by the driver. In order

to have enough space and make sure the data not to be lost, the buffer size (sampling

count) needs to be set properly.

Please refer to the Table 5-1 as below for setting buffer size:

Condition\Method Buffer Size (Unit: bytes)


Even Multiple of the Multiple of the count >4K

(recommended)
FIFO/2 Size of channels

(recommended)

Cards with and Interrupt

using FIFO DMA


Bus-Master

(recommended)
DMA
Cards without or Interrupt

not using FIFO


Table 5-14 Buffer size for FAI transferring

For the cards using FIFO, if it is sampled by interrupt, the buffer size should be an

Advantech IAG Training Center (Internal Use Only)


162

even number and a multiple of half the FIFO size, while it is recommended to be a

multiple of the channel count. If it is sampled by DMA, the buffer size should be an

even number. If it is bus-master DMA, there is no limit to the size of buffer, while 4k

bytes are recommended.

2. Engage the data sampling

Interrupt mode data sampling will be started by the DRV_FAIIntStart function.

For DMA mode data sampling, DRV_FAIDmaStart or DRV_DAIDmaScanStart

is used. The DRV_FAIDmaExStart function is for bus-master DMA.

Different sampling methods need different settings. The corresponding structure

for each method needs to be created first and use its pointer as a function parameter in

order to pass all necessary settings, including the previous initiated buffer, to the

driver.

Please note that DAQ cards only support the functions the hardware supports.

For example, PCL-818 supports interrupt and DMA sampling and PCI-1712 supports

bus-master DAM sampling. Trying to call an unsupported function will return an error

code. Please refer to functions support table and the Hardware Manual for more

Advantech IAG Training Center (Internal Use Only)


163

details.

3. Data transfer

Once the data sampling is engaged, users have to know the current sampling

status and transfer data from sampling buffer to user buffer in time for later operation.

Two methods are used to get the sampling status. One is to enable the required events

(by calling DRV_EnableEvent) and wait for the event notification (by calling

DRV_CheckEvent), then check the status (by calling DRV_FAICheck); the other

is to check the data transferring status repeatedly (by calling DRV_FAICheck).

When the event is signaled or the checked status indicates that either buffer is full,

call the data transfer function DRV_FAITransfer to fetch data from sampling data

buffer to user buffer.

Following is a list of the Events supported in FAI:

ADS_EVT_INTERRUPT Triggered when a certain number of interrupts occur. The number is specified

when applications call the DRV_EnableEvent.


ADS_EVT_BUFCHANGE Generally, in the high speed analog input operation, user's buffer is divided into

two equal parts, the low buffer and the high buffer. Data from the device will fill

Advantech IAG Training Center (Internal Use Only)


164

them separately. This event will be signaled when either buffer is full.

Applications can call the DRV_FAICheck to check which buffer is full, and

then call the DRV_FAITransfer to take away the data in this buffer. If the data

hasn't been taken away in time, the event ADS_EVT_OVERRUN will be

signaled.
ADS_EVT_TERMINATED Triggered when a high speed analog input operation finishes, or when

applications call the DRV_FAITerminate.


ADS_EVT_OVERRUN Triggered when the data in the buffer has not been taken away in time after an

ADS_EVT_BUFCHANGE occurs.

If ADS_EVT_OVERRUN occurs, the data would be overwritten by new ones.


ADS_EVT_TIME_OUT Triggered when no event has occurred during the wait interval in the

DRV_CheckEvent.
Table 5-15 Events supported for FAI transferring

The Figure 5-29 explains how the sampling buffer works and when the data is

transferred:

Advantech IAG Training Center (Internal Use Only)


165

Figure 5-114 The operation of the sampling buffer and the data transferring

The four graphs as shown above show the sampling buffer working on a proper

cycle:

(1) The sampling data buffer is used as two equal size sections, the 1st half (Low

Half) and the 2nd half (High Half). When the sampling starts, the driver will write

data starting from the 1st half.

(2) When the DRV_EnableEvent function is called, should the 1st half be full,

the driver will create a buffer change event (ADS_EVT_BUFCHANGE) to notify

the user's program. The user's program should transfer the data in time, otherwise the

buffer will overrun if the 2nd half is full.

(3) At the same time, data sampling keeps going on the 2nd half during the data

Advantech IAG Training Center (Internal Use Only)


166

transfer.

(4) When the DRV_EnableEvent function is called, should the 2nd half be full,

a buffer change event (ADS_EVT_BUFCHANGE) will be signaled. The data

sampling will be completed for non-cyclic mode, while for cyclic mode, data will log

back to the 1st half again (graph 1).

As described above, if the data has not been transferred in time, the previously

acquired data will be overwritten. See the Figure 5-30:

Figure 5-115 Overrun occurs

After the sampling, we need to copy the data from the sampling data buffer to the

transfer buffer for analysis (by calling DRV_FAITransfer), so that the transfer

buffer should also be allocated. However, the size of the transfer buffer should be no

Advantech IAG Training Center (Internal Use Only)


167

less than 2*sampling count bytes when the data type is raw data (2 bytes per raw

data), or no less than 4*sampling count bytes when the data type is float data (4 bytes

per analog data).

Figure 5-116 The size of the transfer buffer

4. Stop FAI functions

DRV_FAITerminate is used to stop the data sampling. When the user calls the

DRV_EnableEvent function and enables the Terminate event, should the

DRV_FAITerminate function be called or the operation is completed under non-

cyclic mode, the driver will stop the operation and free some resources and send the

ADS_EVT_TERMINATED event to the user. Then the user can do operation such

as closing the device in the event handling function.

Advantech IAG Training Center (Internal Use Only)


168

In non-cyclic mode, when the operation completes, the driver will stop

automatically. If the user does not call the DRV_EnableEvent, the event

ADS_EVT_TERMINATED will not be enabled. In cyclic mode, the operation will

not be stopped until the user calls the DRV_FAITerminate. Calling the

DRV_EnableEvent to enable the ADS_EVT_TERMINATED event is

recommended.

5.4.2.1 Fast AI Transferring by Interrupt

There are two kinds of interrupt operations for analog input. One generates a

hardware interrupt for each conversion. The other one keeps the conversion data in

FIFO, and then generates a hardware interrupt for a half-full FIFO or full FIFO

depending on the hardware. The driver will catch these interrupts. Various events will

occur to notify the user of the acquisition status.

Similar to the software polling, this type of transferring also provides two kinds

of functions. One is for single channel reading, and the other is for multiple- channel

reading.

Advantech IAG Training Center (Internal Use Only)


169

1. Event Notification (Recommended)

Please refer to the Figure 5-32 which shows the typical function call flow for

single channel reading. The DRV_EnableEvent function enables the notification

event and then starts the analog input operation by DRV_FAIIntStart. The driver

will send a proper event to notify the status of the acquisition progress.

DRV_CheckEvent may then be used to check the signaled event and handle the

data. The operation may be stopped by the DRV_FAITerminate function at any

time.

Advantech IAG Training Center (Internal Use Only)


170

Figure 5-117 The flow chart of the FAI transferring by Interrupt (Event Notification)

2. No Event Notification

The DRV_FAIIntStart function starts the analog input operation with interrupt

transferring. The DRV_FAICheck function may be used to check the status of the

operation. Meanwhile the DRV_FAITransfer function may be used to retrieve data.

The operation may be stopped by the DRV_FAITerminate function when the

Advantech IAG Training Center (Internal Use Only)


171

conversion is completed or at any other time. In this type of conversion, no event

notification of the acquisition status will be received. The only way to retrieve the

status is to call the DRV_FAICheck to check the status of the acquisition progress.

Figure 5-118 The flow chart of the FAI transferring by Interrupt (No Event Notification)

Besides single data reading, the driver also provides the DRV_FAIIntScanStart

function for multiple channel reading. For this kind of operation, you should set the

buffer size (the Count parameter) to be a multiple of the number of channels.

Otherwise, for cyclic mode, the first data in the buffer may not correspond to the

starting channel.

Now please refer to the AD_INT examples for VC program which you can

find in the route: C:\Program Files\Advantech\Adsapi\Examples\VC\AD_INT. As the

Advantech IAG Training Center (Internal Use Only)


172

same as the software polling, we have to use the DRV_DeviceOpen to open the

corresponding installed device first. And then use the DRV_DeviceGetFeatures to

retrieve the device's features. But please note we have to allocate a buffer for the data

storage of the data acquisition as shown in the Figure 5-34.

Figure 5-119 Allocate a memory buffer

After that, we can use the DRV_EnableEvent to enable a specified event by

specifying the corresponding EventType.

Advantech IAG Training Center (Internal Use Only)


173

Figure 5-120 Enable the event

Use the DRV_FAIIntStart to initiate a single-channel FAI operation with the

interrupt transfer, by way of specifying an AI channel and pre-initiating the sampling

buffer for data storage. At the same time, we can create a thread to do the event check

and transfer data.

Advantech IAG Training Center (Internal Use Only)


174

Figure 5-121 Initiate the FAI (Interrupt) operation and create a thread

In the thread, we can use the DRV_CheckEvent to check whether the buffer

change occurs, and also use the DRV_FAICheck to retrieve the current status of FAI

operations (not ready: 0, first half ready: 1, second half ready: 2). Once there is an

event, the DRV_FAITransfer will transfer data from FAI sampling buffer to user's

Advantech IAG Training Center (Internal Use Only)


175

buffer. If the buffer is HalfReady (checked with the function DRV_FAICheck),

then the data must be transferred in order to avoid being overwritten.

Finally, please remember to free the buffer you allocate and use the

DRV_FAITerminate to stop the running FAI operation by safely resetting hardware,

releasing resources and sending a terminate event to the user after the data conversion.

If you want to close the program, please use the DRV_DeviceClose to close

the DriverHandle specified device.

Advantech IAG Training Center (Internal Use Only)


176

Figure 5-122 Check the status of FAI operation and transfer the data

Advantech IAG Training Center (Internal Use Only)


177

5.4.2.2 Fast AI Transferring by DMA

DMA Transferring is the fastest data acquisition type of the analog input operation.

The data directly flows from the device to the memory without the interference of the

CPU. The driver will monitor the progress of the conversion and send a proper event

to notify the user of the current conversion status.

For non-bus master DMA, DRV_AllcoateDMABuffer must be used to allocate

DMA transferring buffer. There is no definite limit to the buffer size.

DRV_FreeDMABuffer must be used to free the allocated DMA buffer. For PCI-

17XX series cards, Bus master DMA transferring is recommended, so it is not

necessary to call these two functions. The DMA buffer size must exceed 4K bytes.

Please refer to the individual device software manual for details.

The calling flow for single channel reading is shown as below:

1. Event Notification (Recommended)

The DRV_EnableEvent function enables the notification event and then starts

Advantech IAG Training Center (Internal Use Only)


178

the analog input operation by DRV_FAIDmaStart (ISA series cards) or

DRV_FAIDmaExStart (PCI series cards). The driver will send a proper event to

notify the status of the acquisition progress. DRV_CheckEvent may then be used to

check the signaled event and handle the data. The operation may be stopped by the

DRV_FAITerminate function at any time.

Figure 5-123 The flow chart of the FAI transferring by DMA (Event Notification)a

Advantech IAG Training Center (Internal Use Only)


179

2. No Event Notification

The DRV_FAIDmaStart function starts the analog input operation with DMA

transferring. The DRV_FAICheck function may be used to check the status of the

operation. Meanwhile, the DRV_FAITransfer function may be used to retrieve the

data. The operation may be stopped by the DRV_FAITerminate function when the

conversion is completed or at any other time. In this type of conversion, event

notification of the acquisition status will not be received. The only way to monitor the

conversion is to call the DRV_FAICheck to check the status of the acquisition

progress.

In the Figure 5-39, DRV_AllcoateDMABuffer and DRV_FreeDMABuffer

are not necessary for PCI series devices.

Advantech IAG Training Center (Internal Use Only)


180

Figure 5-124 The flow chart of the FAI transferring by DMA (No Event Notification)

Besides single data reading, the driver also provides DRV_FAIDmaScanStart

function for multiple channels reading for ISA series. For PCI series cards,

DRV_FAIDmaExStart can provide both single channel and multiple-channel

operation. For such kinds of operation, you should set the acquisition number to a

multiple of the number of channels. Under this configuration, the data will be stored

in the data serially according to the channel number and the first data in the buffer can

always be the first channel's data, which means the data for a specific channel are

always stored in a fixed position in the buffer. Then you can trace the data according

Advantech IAG Training Center (Internal Use Only)


181

the channel number easily. Otherwise, for cyclic acquisition, the first data in the

circular buffer may not be for the starting channel, so you must trace your data

according to the channel number and the acquisition number laboriously.

For the programming of the DMA function, you can refer to the AD_DMA_BM

VC example which can be found in the route: C:\Program

Files\Advantech\Adsapi\Examples\VC\AD_DMA_BM. Its programming is similar

with the AD_INT: Open device; Get device features; Allocate a memory buffer;

Enable event; Create a thread to check event and retrieve the status of FAI operation;

Terminate the FAI operation finally. The only difference is we will use the

DRV_FAIDmaExStart to initiate a single-channel FAI operation with bus-master

DMA transfer, by way of specifying an AI channel and pre-initiating the sampling

buffer for data storage. For more information, please refer to the examples and the

Advantech Device Driver Manual.

Advantech IAG Training Center (Internal Use Only)


182

Figure 5-125 Initiate the FAI (DMA) operation

5.4.3 The programming for the AvtiveDAQ Pro Driver

We will show you in this section a project using the ActiveDAQ Pro controls to do

the programming. After this practice, we believe you will be more familiar with the

programming of the ActiveDAQ Pro controls under .Net environment.

First of all, please install the Advantech Device Manager and the ActiveDAQ Pro

Advantech IAG Training Center (Internal Use Only)


183

driver. Then please follow the steps as below to add the ActiveDAQ Pro controls in

the VB.Net project in Visual Studio 2005. For more information, please refer to the

Advantech ActiveDAQ Pro Control Help.

1. New a VB.Net Windows application project

Figure 5-126 New a VB.Net project

2. As shown in the Figure 5-42, right-click and select Choose Toolbox Items in the

Toolbox. Then Add the ActiveDAQ Pro Controls in COM Components tab. You

Advantech IAG Training Center (Internal Use Only)


184

can add the AI, AO, DIO, Counter and other GUI controls here. After clicking the

OK button, you will see the controls are already added in the Toolbox as shown

in the Figure 5-43.

Figure 5-127 Add ActiveDAQ Pro controls

Advantech IAG Training Center (Internal Use Only)


185

Figure 5-128 Add ActiveDAQ Pro controls (continued)

3. Drag the AI control onto the Form, and right-click to check its properties.

Advantech IAG Training Center (Internal Use Only)


186

Figure 5-129 Check controls properties

4. To start the programming, you can refer to the Figure 5-45 to design the Form for

AI function. You can create a button to select device, and create two textboxes to

show the device name and device number.

AxAdvAI.SelectDevice() (Selects a device from the installed Advantech device

list in the system)

textBox1.Text=AxAdvAI.DeviceName (Retrieve the device name)

textBox2.Text=AxAdvAI.DeviceNumber (Retrieve the device number of the

current opened device)

Then create a button to read the AI and also create a textbox (textBox3) to

show the AI reading.

AxAdvAI.ChannelNow=0 (Set the currently selected AI channel)

textBox3.Text=AxAdvAI.DataAnalog (Retrieve the sampling data (float) from

the current AI channel on the DAS card)

Advantech IAG Training Center (Internal Use Only)


187

Figure 5-130 Design the Form for AI function

You will find that the programming steps of the ActiveDAQ Pro drive is the same

as the Advantech Device Driver. But the programming is easier.

Figure 5-131 The programming for AI function

5. For the programming of AO function, you can refer to the AdvAO.DataAnalog

example in the Advantech ActiveDAQ Pro Control Help. This property can set an

Advantech IAG Training Center (Internal Use Only)


188

AO output value for the current AO channel.

Figure 5-132 The example of the AdvAO.DataAnalog

You can refer to the Figure 5-48 to design the Form for AO function. Double-

click the Send button and modify the example code from the Advantech

ActiveDAQ Pro Control Help. The programming as shown in the Figure 5-49 is for

your reference.

Advantech IAG Training Center (Internal Use Only)


189

Figure 5-133 Design the Form for AO function

Figure 5-134 The programming for AO function

6. For the DIO function, the programming is very easy. You can just use the

AdvDIO.ReadDiChannel to read back the status of a specified DI channel and

the AdvDIO.WriteDoChannel to output specific digital value on a specified DO

channel. And you can also refer to the programming in the Figure 5-52 to use the

Counter function.

Advantech IAG Training Center (Internal Use Only)


190

Figure 5-135 The example of the AdvDIO.ReadDiChannel

Advantech IAG Training Center (Internal Use Only)


191

Figure 5-136 The example of the AdvDIO.WriteDoChannel

Figure 5-137 The programming for Counter function

Figure 5-138 Design the Form for DIO and Counter functions

7. Finally, you can complete a VB.Net project which has AI, AO, DIO and Counter

functions. You can check if your programming is workable by using the

Advantech DAQ cards such as PCI-1710 or USB-4716. For example, you can just

Advantech IAG Training Center (Internal Use Only)


192

connect AO channels to AI channels directly and use the AI channels to check if

the AO output value is correct. The Error-handling mechanism will help you to

check if there is any improper operation.

Figure 5-139 A VB.Net project which has AI, AO, DIO and Counter functions

Besides, if you want to acquire data in high speed mode, you can refer to example

of the AdvAI.AcquireBulkDataToMemory in the Advantech ActiveDAQ Pro

Control Help. This function can retrieve bulk data from specified AI channels to the

Advantech IAG Training Center (Internal Use Only)


193

user or control allocated memory using FAI. You need to set the parameter

dataCount as the actual sampled data count and it will be retrieved by the return

value of the method. You also have to use the AdvAI.DataSampleRate to set the

sampling frequency for FAI functions in Hz.

Figure 5-140 The example of the AdvAI.AcquireBulkDataToMemory

You can just paste the example code onto your project and modify your

programming as shown in the Figure 5-56. After compiling the program, you can do

Advantech IAG Training Center (Internal Use Only)


194

the test by inputting a signal to the Advantech DAQ devices to check if the reading

value is correct.

If you are still not sure of how to do your programming, you can refer to the

examples which can be found in the route: C:\Program Files\Advantech\ActiveDAQ

Pro\Device Controls\Examples.

Figure 5-141 The programming for FAI operation by using ActiveDAQ Pro AI control

Advantech IAG Training Center (Internal Use Only)


195

Figure 5-142 Run the program

Advantech IAG Training Center (Internal Use Only)


196

Chapter 6 Trouble Shooting

This Chapter will take an example showing you how to duplicate the customers

problem and do the trouble shooting. We can also do some more analyses with the

Questionnaire so that we can solve the problem quickly.

6.1 PCI-1710HG with Thermocouple

One customer had used PCI-1710HG for a long time. In the past, they always used

the platform which has Pentium 4 CPU, and they can measure the temperature with

K-type thermocouple by PCI-1710HG without problem. But they would like to

develop their application on a higher performance platform in a new project. However

they encounter Restart and Blue Screen issue (The error massage is

"Multiple_IRP_Send_Request") when using the system which has AMD CPU or Intel

core 2 dual CPU. The problem can be both occurred in the customers program and

our Thermo example with the latest driver.

1. For this case, we can check some system information first so that we can know

how to simulate the customers application.

Advantech IAG Training Center (Internal Use Only)


197

Which CPU and system do the customer use?

Ans: The customer use AMD Athlon(tm) 7750 Dual-Core CPU on the WinXP system.

Do the customer use the latest driver, and which programming software do the

customer use?

Ans: Yes, the customer already install the latest driver and they use the VC++ for the

programming.

2. Then we can try to duplicate the customers problem so that we can verify it

more easily. But please not we should do the test on the platform which has AMD

Dual-Core CPU.

Do the customers PCI-1710HG run well in the Advantech Device Manager?

Ans: Yes, it can read AI values correctly and its version is 1.5.7.1. From this result,

we can confirm that there is n problem with the basic function of the customers card.

When running our example such as AD_SOFT, AD_INT and Thermo, are there

problems?

Ans: Yes, when running the Thermo example, it indeed encounters Blue Screen issue

(The error massage is "Multiple_IRP_Send_Request"), but other examples run

properly. If using the driver from CD 2.6 version, the API TCMuxRead can only

read the value "NAN". On the AMD platform, both the latest driver and older

driver will encounter problems.

3. So far we already duplicate the customers problem, but we can still do some

Advantech IAG Training Center (Internal Use Only)


198

more tests so that the RD can find the root cause more easily.

How about the Hyper Threading platform? Will it encounter problems?

Ans: Yes, the system will also return blue screen when running the Thermo example.

If we are using the platform which doesnt support Hyper Threading or Core 2

Dual function, can it work?

Ans: Yes, under this situation PCI-1710HG can measure the temperature properly.

From the test results, we can conclude that the problem will only occur on the

Hyper Threading or Core 2 Dual platform. So we can interpret what we do and what

we check in the Questionnaire to speed up solving the problem.

Advantech IAG Training Center (Internal Use Only)

Vous aimerez peut-être aussi