daqingshu
西双版纳

Anton Eliens,Principles of Objected Oriented Software Development.Addision Wisley Publishing ltd.2000

   The successful implementation of a microcomputer based system requires that means be found to link a process to the microcomputer. This is true in all cases except where the data are being input via a visual display unit for routine non-real-time processing and output via the visual display unit and line printers. In real-time process data acquisition systems, the sensors used to detect the current state of a process have to be interfaced directly to the microcomputer.  Similarly,  if the microcomputer is being used to effect direct digital controlDDC),then the actuators must be interfaced to the microcomputer system. The interfacing procedure can be represented in conceptual terms by Fig. 13-1In some cases it is necessary to amplify the current or voltage output by the microcomputer so that the actuators can be operated.

    Careful interfacing of the microcomputer to the sensors and actuators is required so that real-time data acquisition and control can be carried out. Specialized and rather expensive interface circuitry and actuators are necessary. The interface requirements for all the available sensors and actuators are not identical. Thus,  for example, the mill volt output form a thermocouple must be amplified to bring it to the microcomputer range of 1 5 volts, and the amplified analog voltage must be converted into digital format, using analog to digital converters, before being  input to the microcomputer. A light emitting diodeLED requiring a very small amount of voltage and current to drive, it could be directly interfaced to the microcomputer. The application of the microcomputer to control the power input to a heating element would necessitate the use of a silicon controlled rectifier. Similarly, the operation of a pneumatic actuator requires that the electrical signals be converted into pneumatic signals before being applied to the actuator. Thus the interfacing requirements for sensors and actuators vary from one element to another. The characteristics of the microcomputer used also have to be taken into account.

    Most microcomputers have limited numbers of pins for input/output purposes. It is, therefore, necessary to use a multiplexer which transfers data from a number of linessensors into one line for connecting to the microprocessor input port. Similarly a de-multiplexer is necessary for transferring the data from one output port to a number of lines connected to actuators or other peripheral devices. Multiplexers and de-multiplexers are effectively time-sharing devices which simplify and reduce the cost of interfacing a process to the microcomputer.

    In an overall sense, the inputs, the outputs, the microcomputer and the interface circuitry requirements can be illustrated by Fig. 13-2. While this diagram illustrates the schematic of microcomputer/process interfacing, the actual configuration will vary depending upon the number of inputs and outputs, and the accuracy/resolution requirements of converters. Similarly, the characteristics of multiplexers have to be taken into account. Suitable sensors are not available for monitoring many of the variables of interest which must then be inferred. Under these circumstances it becomes necessary to use sample and hold devices to ensure that the two operative variables from which the value of another variable is to be inferred, were all sampled at the same instant of time. The cost of many sensors can be considerable. Similarly, the fitting of new actuators to existing machines, in order to implement a suitable control system, can be very expensive. Without the availability and interfacing of suitable sensors and actuators, the microprocessor /computer cannot be used for on-line data acquisition and process control. The cost of the microcomputer and associated computer peripherals will be much lower than the cost of the sensors, actuators and interface circuits. It is therefore essential that, wherever possible, the sensors, actuators and interface circuits should be selected to minimize the overall system cost.

While a given microprocessor chip, manufactured in large quantities, can form the basis of a large number of microcomputer configurationsthe same is not true of the interface logic circuits. A large number of interfacing chips do exist, but they have to be configured to suit the application under consideration. It is difficult to standardize interface circuits since the requirements vary from one sensor to the next and from one actuator to the next. Standard circuits can, however, be used for related functions of analog to digital conversion (ADC)digital to analog conversionDAC )multiplexing and de-multiplexing.

Microprocessor Input/Output

    All microprocessors have input /output ports which can be used to transfer information between the central processing unit and external devices such as floppy discs, cassettes, visual display units and line printers. The microcomputer supplier usually provides the interface circuitry required for connecting floppy discs and cassettes to the microcomputer. Standard interfaces, such as RS 232 or a suitable parallel interface, are used to connect v.d.u.'s and line printers to the microcomputer. Further input/output ports are available to interface the process with the microcomputer. These ports contain buffers for holding data until they are required by the microprocessor or the peripheral to which the data is to be output. These input/output ports are connected to the data bus. The microcomputer can address the input ports and transfer data from the port to the data bus which is bi-directional, i.e. it can transfer data to and from the microcomputer. Control linescircuitry are required to select the port from which data are to be input or to which data are to be output so as to avoid any conflicts. This is achieved by selecting a particular input /output port and allowing the data transfer to fake place. The high speed at which data transfer takes place inside a microcomputer means that a number of ports can be addressed over a short period of time. The transfer of data between the central processing unitCPU and the peripherals can take place either in parallel mode8or16bits at a time or in serial mode1 bit at a time).Different techniques such as polling, interrupted input /output and direct memory accessDMA),are used for communications between the microcomputer and the peripherals. These modes all have their applications and it is possible to use all of them, in a given microprocessor, for different types of data transfer. The actual transfer of data might be one data value at a time or it might be a continuous transfer of a block of dataPrograms are needed to acquire the data from the peripherals or sensors and store them on secondarymass storage devices or output the data to other storage media such as paper tape.

    The task of data transfer between the microprocessor and the outside world (sensors, actuators or peripherals) can be simplified by using Large-scale integrated (LSI) chips which can be programmed to suit a particular set of requirements. Typically a chip used for parallel data transfer contains two or more 8-bit ports which can be configured to input data to the microprocessor or output the data to a peripheral device. A register is used to define the direction in which the data is to be transferred by the corresponding bits of the port. The microprocessor can be programmed to define the data transfer direction.

    The port and the data direction register associated with it contain 8-bits each. The direction of data transfer is specified by setting all the 8-bits in the data direction register to0 for input and to 1 for output. It is also possible in some systems to define the direction of data transfer for each individual line or bit by setting the bit appropriately in the data direction register. The high degree of flexibility of the input/output chips makes them suitable for a wide range of applications. Thus, for example, if it was necessary to use the first four lines for input and the remaining four for output, the first four bits of the data direction register would be set to 0zeroand the remaining four to 100001111).A sub-routine program can be used to initialize the contents of these registers. These chips carry out additional functions such as 'hand shaking', data transfer to and from the bus, interrupt and status control. Chip select lines are used to select the inputoutput chip by means of a suitable code and distinguish it from other registers in the random access memory and read only memory. The programmer can also address any of the individual registers in the interface chip directly.

    The typical user in the manufacturing environment is not normally interested in designing the circuitry for interfacing the microcomputer with standard peripherals such as cassettes, floppy disks, keyboards, visual display units, teletypewriters or printers. Standard interfaces for this purpose are inexpensive and readily available. The principal interest in the industrial environment lies in interfacing the microcomputer to the process from which the data must be acquired and which will subsequently be controlled. The interfaces required in this case will vary depending upon the type of sensors and actuators used. Some transducers will provide low voltage or low current analog signals, while others provide the digital data which may be input directly to the microcomputer. Similarly the microcomputer output signals will have to be conditioned before they are applied to the actuator concerned. The amplification requirements will vary as will the sampling rates depending upon the signal levels and process time constants respectively. The signal levels, produced by the vast majority of sensors, can be divided into three categories.

        Low voltage output, typically in the millivolt range.

        Low current output, typically in the range 4-20 mA.

        High voltage output of zero to several volts.

    The microcomputer system has to cope with these different signal levels. Similarly, it must provide different signal levels which are suitable for operating different actuators. Furthermore the typical industrial environment is likely to introduce noise on to the signals and in some cases the noise can completely overwhelm the signal provided by the sensor. High-voltage transients are picked up by the on and off switching of other equipment. It is therefore necessary to take measures to prevent such extraneous data from entering the computer which could at best affect the efficiency of process control and at worst could cause irreparable damage to the microcomputer system. A number of devices, external to the microcomputer, can be used to. interface the microcomputer to the process. The following devices are commonly used for interfacing sensors and actuators to the microcomputer.

    1. Analog to digital converters.

    2. Digital to analog converters.

    3. Pneumatic to current converters and current to pneumatic converters.

    4. Multiplexers.

    5. Sample and hold circuits.

    6. Amplifiers.

    All these devices perform particular functions. some of which are now discussed. Analog to Digital Converters (ADC)

    These devices are used to convert continuous analog signals into digital format, i. e. binary numbers. A number of techniques, all of which involve a comparison between the analog signal and a reference signal, can be used to carry out analog to digital (A to D )conversion. The actual conversion process involves sampling the signal at a given instant of time and holding it before a stable signal level is input to the analog to digital converter. The binary output from the analog to digital converter is input to the microcomputer through its input channel.

    It is possible to carry out analog to digital conversion by using complex hardware or by using simple hardware along with suitable software instructions. The use of software reduces the speed of the analog to digital conversion process. High-speed analog to digital conversion requires the use of hardware for the whole process. The analog to digital converters used in particular applications can be distinguished according to their accuracy and the speed. High-speed A to D conversion is necessary if a particular channel is sampled at very fast rates. In a typical industrial environment, A to D converters are not directly attached to individual sensors. Instead a number of sensors are attached to a multiplexer, and the analog to digital converter is shared between them.

Digital to Analog Converters (DAC

    Data acquisition systems only require the use of analog to digital converters to input the sensed data to the microcomputer system. In a computer-aided process control system, the process control actions are recommended to the operator and output on the operator terminal. Automatic closed loop process control systems require that the sensed data be manipulated to decide the control action which should subsequently be implemented automatically by means of suitable actuators. The vast majority of the actuators, other than stepping motors and relays, require analog voltages and currents for their operation. It is, therefore, necessary to convert the digital binary output form the microcomputer into analog format. Software as well as hardware techniques are available to carry out the required digital to analog conversionDAC )

    Digital to analog conversion using software techniques involves the generation by the microcomputer of a series of pulses which represent the digital information. The pulses are then applied to a resistor capacitor network which converts the digital data into an averaged. c. signal. This software DAC technique is inexpensive but very slow and unsuitable for high-speed applications. Monokuthic, single-chip digital to analog converters, which use hardware to carry out high-speed conversion, are available at low cost.

Analog Multiplexers

    Another important factor in microcomputer-based analog conversion systems is the ability to accept more than one analog signal into an AD converter. This is called multiplexing. There are two ways to multiplex a microcomputer system for analog conversion. One way is to simply connect several. ADs to the microcomputer, each connected to and converting its own signal. This approach is called digital multiplexing because the multiplexing is actually taking place on the digital side of the AD converters.

    A major disadvantage of digital multiplexing is cost. A separate converter is required for each analog signal to be converted. If there are twenty or thirty signals of interest, the cost will be excessive.

    An alternative to digital multiplexing is analog multiplexing. In this approach, a device that acts as a rotary switch is connected to the input of the ADC. Any one of several analog signals can be connected to the analog input through this switch, which is under microcomputer control.

    Four important factors in choosing an analog multiplexer are power supply requirements, switching speed, signal handling capability, and channel crosstalk. Power requirements tend to match those of the converters. The15 and-15 volt power supplies are again common. Switching speeds range from a few microseconds for the slower devices to tens of nanoseconds for the fastest ones.

    Signal handling ability ranges widely. Some multiplexers can handle input signals very close to the power supply voltages. Others can't handle signals within one or two volts of the power supplies. The differences come from the different fabrication technologies used for the various multiplexing circuits.

    Channel crosstalk relates to the leak of signal between multiplexer channels. Crosstalk is also directly related to the frequencies of the signals being multiplexed caused by capacitive coupling in the multiplexer.
posted on 2006-02-26 01:02  Edvard  阅读(463)  评论(0)    收藏  举报