Pc As A Platform For Data Acquisition Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Data AcQuisition is simply the process of bringing a real-world signal, such as avoltage, into the computer, for processing, analysis, storage or other data manipulation.A Physical phenomena represents the real-world signal you are trying to measure.Today, most scientists and engineers are using personal computers with ISA, EISA, PCI or PCMCIA bus for data acquisition in laboratory, research, test and measurement, and industrial automation. Many applications use plug-in boards to acquire data and transfer it directly to computer memory. Others use DAQ hardware remote from the PC that is coupled via parallel port, serial port, GPIB-Bus or Network. Typically, DAQ plug-in boards are general-purpose data acquisition instruments that are well suited for measuring voltage signals. However, many real-world sensors and transducers output signals that must be conditioned before a DAQ board or device can effectively and accurately acquire the signal. This front-end preprocessing, which is generally referred to as signal conditioning, includes functions such as signal amplification, filtering, electrical isolation,and multiplexing. In addition, many transducers require excitation currents or voltages, bridge completion, linearization, or high amplification for proper and accurate operation.

Simplified Block Diagram of a DATA ACQUISITION SYSTEM

The PC as a platform for data acquisition

The field of data acquisition encompasses a very wide range of activities. At its simplest level, it involves reading electrical signals into a computer from some form of sensor. These signals may represent the state of a physical process, such as the position and orientation of machine tools, the temperature of a furnace or the size and shape of a manufactured component. The acquired data may have to be stored, printed or displayed. Often the data have to be analyzed or processed in some way in order to generate further signals for controlling external equipment or for interfacing to other computers. This may involve manipulating only static readings, but it is also frequently necessary to deal with time-varying signals as well. Some systems may require data to be gathered slowly, over time spans of many days or weeks. Other will necessitate short bursts of very high speed data acquisition - perhaps at rates of up to several thousand readings per second. DAQ is used widely for laboratory automation, industrial monitoring and control, as well as in a variety of other time-critical applications.

The most important reason for using the PC for data acquisition and control is that there is now a large and expanding pool of programmers, engineers and scientists who are familiar with the PC.Indeed it is quite likely that many of these personnel will have learnt how to program on an IBM PC or PC clone.

The processor

Pentium processors are perhaps the most recognized components of today's PCs. They originate from a long line of Intel processors dating back to the 1970s (see Table 1.1). The capabilities of the earlier processors will be of little relevance to most readers who,nowadays, are not likely to encounter anything more primitive than an 80486. For this reason we will not discuss them in any further detail. We should remember, though, that some specialized systems (particularly embedded PC applications) still make use of the earlier 8086, 80286 and 80386 processors. Indeed, special versions have been developed for this market. The 80186, for example, is similar to the 8086, but also possesses on-chip DMA (Direct Memory Access) and interrupt controllers and other support circuitry. The 80186 and similar special-purpose processors are not used in a normal PC. From the viewpoint of application-software development, it is convenient to divide the various PC processors into three classes:real-mode processors (8088, 8086 and compatibles such as the NEC V20 and V30); the intermediate 80286 processor (which we will not discuss); and full 32-bit processors (80386, 80486, Pentiums and Celeron processors).Because each new processor in the sequence incorporates a superset of the instructions and features of earlier processors, they are termed 'backward compatible'. Software written for an 80286 processor, for example, will generally be able to run on 80386 and all later processors. Even the latest Pentium processors can operate in real mode, emulating the early 8086. Note, however, that the converse is not true: an 8086 will not run most of the software written for the Pentium. In spite of this backward compatibility, the timing of many instructions varies between processors. The speed of most instructions tends to be greater in the newer processors although some instructions may execute more slowly. This point should be borne in mind when writing very time-critical code, particularly if the software is intended to run on a range of different processors.

Memory Map of PC

Input/output ports

In addition to its memory, the PC has another entirely separate address space. This is dedicated to transferring data to or from peripheral devices and is known as Input/Output space (or simply I/O space). Just as the PC's memory space is divided into separate byte locations, the I/O space consists of many byte-sized I/O ports. Each port is addressable in much the same way as memory, although an additional control line is used within the PC to distinguish between memory and I/O port accesses. I/O space consists of a contiguous series of I/O addresses. Unlike memory space, the I/O address space is not segmented and cannot be paged. In fact, the processor references I/O ports by means of a 16-bit address and this means that no more than 65 536 I/O ports can be supported by the PC. In practice, this is further limited by the I/O address decoding scheme used on the PC and its adaptor cards.The I/O ports provide a means of sending data to, and receiving data from, devices such as the video adaptor, the disk subsystem,or analogue-to-digital converters (ADCs) on plug-in data-acquisition cards. Software can use the

assembly language IN or OUT instructions,or their high level language counterparts, to communicate with hardware devices via the I/O ports. These are discussed in more detail in Chapter 6, but for the moment we will consider a simple example. Suppose that a plug-in 8-bit ADC card possesses control and data registers that are each mapped to one of the PC's I/O ports. The software starts the analogue-to-digital conversion process by writing a bit pattern to the I/O port that maps to the ADC card's control register. When the ADC has finished the conversion it might set a bit (known as the End of Conversion, or EOC, bit) in another register to indicate that digitized data is now available.In this way, the software is able to detect the EOC bit by reading the corresponding I/O port.

I/O port allocation

Hardware devices map their registers to specific I/O ports simply by decoding the PC's address bus and control lines. In this way, a specific combination of address and control lines is needed to cause data to be transferred from the register to the PC's data bus or vice versa. Some I/O ports can only be read or written, while others are capable of bidirectional data transfer. Whether ports are read-only (R/O), write-only (W/O) or read-write (R/W) is determined by how the hardware decodes the address and control lines.

Buses and adaptor card slots

Passing data to and from a DA&C card via an I/O port actually involves transferring the data over one or more system buses. A typical PC may not contain all of the buses shown, although the PCI and ISA buses are present in most systems. Other types of bus (many of them proprietary systems) can be interfaced by means of special adaptors or bridges to the PC. The IEEE-488 bus and the VXI bus, for example, are used in specialized instrumentation applications. Of primary concern here though are the PC's native buses - i.e. the ones that are an integral part of the PC's own architecture. The type of bus used within the PC not only has a bearing on the type of interface card that can be connected, it may also have a profound effect on the throughput of the system as a whole.

Software Considerations

A typical DA&C program may contain the following modules and facilities:

program configuration routines

diagnostics modules

system maintenance and calibration modules

run-time modules

device drivers

data analysis modules. Schematic illustration of a typical DAQ program


Sensors are the primary input element involved in reading physical quantities (such as temperature, force or position) into a DA&C system. They are generally used to measure analogue signals although the term 'sensor' does in fact encompass some digital devices such as proximity switches. In this section we will deal only with sensing analogue signals.Analogue signals can be measured with sensors that generate

either analogue or digital representations of the quantity to be measured (the measurand).

Digital tachometers

A tachometer (also called a revolution-counter, rev-counter, or RPM gauge) is an instrument that measures the rotation speed of a shaft or disk, as in a motor or other machine. The device usually displays the revolutions per minute(RPM) on a calibrated analogue dial, but digital displays are increasingly common. Measurement resolution is governed by the number of marks around the circumference. Various types of sensor are used, such as optical, inductive and magnetic ones. As each mark is sensed, a pulse is generated and input to an electronic pulse counter. Usually, velocity is calculated in terms of the pulse count in unit time, which of course only yields information about the mean velocity. If the velocity is changing, instantaneous velocity can be calculated at each instant of time that an output pulse occurs, using the scheme shown in Figure .In this circuit, the pulses from the transducer gate the train of pulses from a 1MHz clock into a counter. Control logic resets the counter and updates the digital output value after receipt of each pulse from the transducer. The measurement accuracy of this system is highest when the speed of rotation is low.

Optical sensor

Optical Tachometer also called hand held stroboscope is used for the study of rotating, reciprocating, oscillating or vibrating machine parts and vibrating strings. Optical pulses

can be generated by one of the two alternatives photoelectric techniques illustrated in Figure, the

pulses are produced as the windows in a slotted disc pass in sequence between a light source and

a detector. The alternative form has both light source and detector mounted on the same side of a

reflective disc which has black sectors painted onto it at regular angular intervals. Light sources

are normally either lasers or LEDs, with photodiodes and phototransistors being used as detectors.Optical tachometers yield better accuracy than other forms of digital tachometer but are not as reliable because dust and dirt can block light paths.

Inductive sensor

A variable reluctance sensor (VRS) is used to measure position and speed of moving metal components. This sensor consists of a permanent magnet, a ferromagnetic pole piece, a pickup coil, and a rotating toothed wheel.

As the gear teeth of the rotating wheel (or other target features) pass by the face of the magnet, the amount of magnetic flux passing through the magnet and consequently the coil varies. When the gear tooth is close to the sensor, the flux is at a maximum. When the tooth is further away, the flux drops off. The moving target results in a time-varying flux that induces a proportional voltage in the coil. Subsequent electronics are then used to process this signal to get a digital waveform that can be more readily counted and timed.

A permanent magnet is an object made from a material that is magnetized and creates its own persistent magnetic field. An everyday example is a refrigerator magnet used to hold notes on a refrigerator door.

In its most basic form, a VR sensor consists of a coil of wire wrapped around a magnet.

As gear teeth (or other target features) pass by the face of the magnet, they cause the

amount of magnetic flux passing through the magnet, and consequently the coil, to vary.

When a target feature (such as a gear tooth) is moved close to the sensor, the flux is at a

maximum. When the target is further away, the flux drops off. As the target moves, this

results in a time-varying flux that induces a proportional voltage in the coil. Subsequent

electronics are then used to massage this signal to get a digital waveform that can be

more readily counted and timed. One area in which VR sensors excel, however, is in high-temperature applications.

Because operating temperature is limited by the characteristics of the materials used in

the device, with appropriate construction VR sensors can be made to operate at

temperatures in excess of 300°C. An example of such an extreme application is sensing

the turbine speed of a jet engine. VR sensor interface circuits VR sensors need waveform shaping for their output to be digitally readable. The normal output of a VR sensor is an analog signal, shaped much like a sine wave. The frequency and amplitude of the analog signal is proportional to the target's velocity.

Output of the tachometer

E=bmwr sin (mwrt)

b- amplitude of flux variation

m- number of teeth in the rotating wheel

wr -angular velocity of the rotating wheel

Thus sinusoidal signal amplitude E= bmwr and frequency f=mwr/2Ï€ are proportional to

angular velocity of wheel.

However this output voltage comes in the range of mili volt . But the requirement of Data

acquisition card is that input should be in the range of +/- 5 volt. So it need to be amplified prior

to inputting it into Data acquisition card.


The output voltage from the sensor would be fed to the amplifying circuit input .The output of the sensor is in mill volt so we need to amplify it to bring it to the input range of Pcl card 208.After the voltage getting amplified it would get noise in the process for which it has to pass through signal conditioning element .After that the voltage would be fed into input of Pcl card.

An operational amplifier, which is often called an op-amp, is a DC-coupled high-gain electronic voltage amplifier with a differential input and, usually, a single-ended output. An op-amp produces an output voltage that is typically millions of times larger than the voltage difference between its input terminals.

Typically the op-amp's very large gain is controlled by negative feedback, which largely determines the magnitude of its output ("closed-loop") voltage gain in amplifier applications, or the transfer function required (in analog computers). Without negative feedback, and perhaps with positive feedback for regeneration, an op-amp essentially acts as a comparator. High input impedance at the input terminals (ideally infinite) and low output impedance at the output terminal(s) (ideally zero) are important typical characteristics.

Op-amps are among the most widely used electronic devices today, being used in a vast array of consumer, industrial, and scientific devices. Many standard IC op-amps cost only a few cents in moderate production volume; however some integrated or hybrid operational amplifiers with special performance specifications may cost over $100 US in small quantities. Op-amps sometimes come in the form of macroscopic components, (see photo) or as integrated circuit cells; patterns that can be reprinted several times on one chip as part of a more complex device.

The op-amp is one type of differential amplifier. Other types of differential amplifier include the fully differential amplifier (similar to the op-amp, but with two outputs), the instrumentation amplifier (usually built from three op-amps), the isolation amplifier (similar to the instrumentation amplifier, but with tolerance to common-mode voltages that would destroy an ordinary op-amp), and negative feedback amplifier (usually built from one or more op-amps and a resistive feedback network).

Circuit notation



Circuit diagram symbol for an op-amp

The circuit symbol for an op-amp is shown to the right, where:

V_{\!+}: non-inverting input

V_{\!-}: inverting input

V_{\!\text{out}}: output

V_{\text{S}\!+}: positive power supply

V_{\text{S}\!-}: negative power supply

The power supply pins (V_{\text{S}\!+} and V_{\text{S}\!-}) can be labeled in different ways (See IC power supply pins). Despite different labeling, the function remains the same - to provide additional power for amplification of signal. Often these pins are left out of the diagram for clarity, and the power configuration is described or assumed from the circuit.

[edit] Operation

The amplifier's differential inputs consist of a V_{\!+}input and a V_{\!-}input, and ideally the op-amp amplifies only the difference in voltage between the two, which is called the differential input voltage. The output voltage of the op-amp is given by the equation,

V_{\!\text{out}} = (V_{\!+} - V_{\!-}) \, A_{OL}

where V_{\!+}is the voltage at the non-inverting terminal, V_{\!-}is the voltage at the inverting terminal and AOL is the open-loop gain of the amplifier. (The term "open-loop" refers to the absence of a feedback loop from the output to the input.)

Op-amp with inverting input grounded through a resistor; input at the non-inverting input, and no feedback

With no negative feedback, the op-amp acts as a comparator. The inverting input is held at ground (0 V) by the resistor, so if the Vin applied to the non-inverting input is positive, the output will be maximum positive, and if Vin is negative, the output will be maximum negative. Since there is no feedback from the output to either input, this is an open loop circuit. The circuit's gain is just the GOL of the op-amp.

Standard two-resistor non-inverting amplifier circuit

Adding negative feedback via the voltage divider Rf,Rg reduces the gain. Equilibrium will be established when Vout is just sufficient to reach around and "pull" the inverting input to the same voltage as Vin. As a simple example, if Vin = 1 V and Rf = Rg, Vout will be 2 V, the amount required to keep V- at 1 V. Because of the feedback provided by Rf,Rg this is a closed loop circuit. Its over-all gain Vout / Vin is called the closed-loop gain ACL. Because the feedback is negative, in this case ACL is less than the AOL of the op-amp.

The magnitude of AOL is typically very large-seldom less than a million-and therefore even a quite small difference between V_{\!+}and V_{\!-}(a few microvolts or less) will result in amplifier saturation, where the output voltage goes to either the extreme maximum or minimum end of its range, which is set approximately by the power supply voltages. Additionally, the precise magnitude of AOL is not well controlled by the manufacturing process, and so it is impractical to use an operational amplifier as a stand-alone differential amplifier. If linear operation is desired, negative feedback must be used, usually achieved by applying a portion of the output voltage to the inverting input. The feedback enables the output of the amplifier to keep the inputs at or near the same voltage so that saturation does not occur. Another benefit is that if much negative feedback is used, the circuit's overall gain and other parameters become determined more by the feedback network than by the op-amp itself. If the feedback network is made of components with relatively constant, predictable, values such as resistors, capacitors and inductors, the unpredictability and inconstancy of the op-amp's parameters (typical of semiconductor devices) do not seriously affect the circuit's performance.

If no negative feedback is used, the op-amp functions as a switch or comparator.

Positive feedback may be used to introduce hysteresis or oscillation.

Ideal and real op-amps

An ideal op-amp is usually considered to have the following properties, and they are considered to hold for all input voltages:

Infinite open-loop gain (when doing theoretical analysis, a limit may be taken as open loop gain AOL goes to infinity)

Infinite voltage range available at the output (vout) (in practice the voltages available from the output are limited by the supply voltages V_{\text{S}\!+}and V_{\text{S}\!-})

Infinite bandwidth (i.e., the frequency magnitude response is considered to be flat everywhere with zero phase shift).

Infinite input impedance (so, in the diagram, R_{\text{in}} = \infty, and zero current flows from v_{\!+}to v_{\!-})

Zero input current (i.e., there is assumed to be no leakage or bias current into the device)

Zero input offset voltage (i.e., when the input terminals are shorted so that v_{\!+}=v_{\!-}, the output is a virtual ground or vout = 0).

Infinite slew rate (i.e., the rate of change of the output voltage is unbounded) and power bandwidth (full output voltage and current available at all frequencies).

Zero output impedance (i.e., Rout = 0, so that output voltage does not vary with output current)

Zero noise

Infinite Common-mode rejection ratio (CMRR)

Infinite Power supply rejection ratio for both power supply rails.

In practice, none of these ideals can be realized, and various shortcomings and compromises have to be accepted. Depending on the parameters of interest, a real op-amp may be modeled to take account of some of the non-infinite or non-zero parameters using equivalent resistors and capacitors in the op-amp model. The designer can then include the effects of these undesirable, but real, effects into the overall performance of the final circuit. Some parameters may turn out to have negligible effect on the final design while others represent actual limitations of the final performance, that must be evaluated.

Circuit diagram of amplifying circuit

Calculation of Amplifier Gain:

Input range: 53 mv to 238 mv

Output range: 0 to 10 v

Required gain : 30



GAIN= Vout/ Vin

= 1+R3/R2

= 1+30/1


Non inverting operational amplifiers were used to get the required gain of 30 . now the output of this amplifying circuit is required to undergo signal conditioning to reduce the noises developed so that it is suitable for the input to the card.

SL No.


Tachometer output (mv)

Amplifier output (v)









































































Output we get after amplification isw sine wave(a.c) . PCL-208 accept dc values only , hence we need rectifiers to convert ac to dc





Time constant of the RC filter used shud be much lesser than the time period of input

finput << 1/RC

50 Hz << 10^6 Hz

SL No.


Output of rectifier (mv)











































Graph is liner for RPM upto 250 so we program accordingly to merasure RPM value till that point

Data acquisition using AT80C51 & ADC0804

AT80C51 Architecture:

8051 Block Diagram:


The logical separation of program and data memory allows the data memory to be accessed

by 8-bit addresses, which can be quickly stored and manipulated by an 8-bit CPU.

Program memory (ROM, EPROM) can only be read, not written to.There can be up to 64k bytes of program memory. In the 80C51, the lowest 4k bytes of program are on-chip. In the ROMless versions, all program memory is external. The read strobe for external program memory is the PSEN (program store enable).Data Memory (RAM) occupies a separate address space from

Program Memory. In the 80C51, the lowest 128 bytes of data memory are on-chip. Up to 64k bytes of external RAM can be addressed in the external Data Memory space. In the ROMless

version, the lowest 128 bytes are on-chip. The CPU generates read and write signals, RD and WR, as needed during external Data Memory accesses.External Program Memory and external Data Memory may be combined if desired by applying the RD and PSEN signals to the

inputs of an AND gate and using the output of the gate as the read strobe to the external Program/Data memory.

8051 Pin Diagram


8051 Programming Model:

ADC 0804


As shown in the typica circuit, ADC0804 can be interfaced with any microcontroller. You need a minimum of 11 pins to interface ADC0804, eight for data pins and 3 for control pins. As shown in the typical circuit the chip select pin can be made low if you are not using the microcontroller port for any other peripheral (multiplexing).

There is a universal rule to find out how to use an IC. All you need is the datasheet of the IC you are working with and take a look at the timing diagram of the IC which shows how to send the data, which signal to assert and at what time the signal should be made high or low etc.


The above timing diagrams are from ADC0804 datasheet. The first diagram (FIGURE 10A) shows how to start a conversion. Also you can see which signals are to be asserted and at what time to start a conversion. So looking into the timing diagram FIGURE 10A. We note down the steps or say the order in which signals are to be asserted to start a conversion of ADC. As we have decided to make Chip select pin as low so we need not to bother about the CS signal in the timing diagram. Below steps are for starting an ADC conversion. I am also including CS signal to give you a clear picture. While programming we will not use this signal.

Make chip select (CS) signal low.

Make write (WR) signal low.

Make chip select (CS) high.

Wait for INTR pin to go low (means conversion ends).

Once the conversion in ADC is done, the data is available in the output latch of the ADC. Data of the new conversion is only avalable for reading after ADC0804 made INTR pin low or say when the conversion is over. Below are the stepts to read output from the ADC0804.

Make chip select (CS) pin low.

Make read (RD) signal low.

Read the data from port where ADC is connected.

Make read (RD) signal high.

Make chip select (CS) high.



To be able to implement analog to digital conversion using the ADC0804LCN 8-bit A/D converter. We designed a circuit and programmed the chip so that when an analog signal is given as input, the equivalent digital voltage is displayed on an LCD display. Thus, in effect, our circuit should function like a simple voltmeter.

Circuit Diagram of Data Acquisition using ADC0804,AT89C51,LCD



The ability to convert analog signals to digital and vice-versa is very important in signal processing. The objective of an A/D converter is to determine the output digital word corresponding to an analog input signal.

The A/D converter operates on the successive approximation principle. Analog switches are closed sequentially by successive-approximation logic until the analog differential input volatge[Vin(+) - Vin(-)] matches a voltage derived from a tapped resistor string across the reference voltage.

The normal operation proceeds as follows. On the high-to-low transition of the WR input, the internal SAR latches and the shift-register stages are reset, and the INTR output will be set high. As long as the CS input and WR input remain low, the A/D will remain in a reset state. Conversion will start from 1 to 8 clock periods after at least one of these inputs makes a low-to-high transition. After the requisite number of clock pulses to complete the conversion, the INTR pin will make a high-to-low transition. This can be used to interrupt a processor, or otherwise signal the availability of a new conversion. A RD operation(with CS low) will clear the INTR line high again. The device may be operated in the free-running mode by connecting INTR to the WR input with CS=0.

Since this is an 8-bit A/D converter, a voltage from 0-5V. O will be repersented as 0000 0000 (0 in decimal) and 5V is represented as 1111 1111 (256 in decimal). To convert a value X volts to decimal, use the following formula: (X * 5.0)/256.

To get a better resolution, and display the vlaue as a floating point number, you can multiply the numerator by a factor of 100, 1000 etc. and then print the voltage accordingly.