Saturday, July 12, 2008

Interfacing Computers Via Software

Modern computers do not respond to energy represented in any form other than voltage generally, not even current. However, The Figure shows the generalized "outside world" as an external system which is propelled by continuous (analog) energy sources (mechanical, electrical, thermal, etc.) and feeds back analog signals that represent some form of energy (eg: temperature, voltage, current, pressure, stress, strain, position, velocity, acceleration, etc.) which is, in general, not a voltage. The closed loop of Figure clearly represents some problems in terms of interfacing the small digital voltage signal world of the computer to the analog energy world outside. Signals fed back from the external system to the computer need to be:

(i) Converted from their original form to voltage
(ii) The raw voltage levels may need to be isolated from the external system
(iii) The raw voltage levels need to be scaled to a level compatible with the
needs of computer circuits
(iv) In the event that the scaled voltages may suffer from unwanted spikes (as a
result of spikes in the energy levels received from the outside world),
protection circuits need to be considered to prevent high signals from
damaging the computer
(v) The scaled voltages need to be converted into a digital form.

The other major problem with connecting digital computers to the outside world is that the circuits within the computer are not only low in energy consumption, but also incapable of providing a large amount of energy. We know that signals within the computer are represented by digital voltages, somewhere in the order of those shown for TTL circuits. However, we also need to appreciate that the major limitation of those circuits within a computer is that they are unable to provide large amounts of current. Typically, a digital circuit can provide less than a milli-Amp of current. This means that digital circuits can only provide a few milli-Watts of power. The actual amount depends upon the type of digital circuit but, in any event, is generally much less than the energy normally required to drive many external systems.

Consider the case where a computer is required to control a power station. The external system is a generator driven by a rotating turbine. The signals fed back to the computer may include items such as turbine speed, output voltages, etc. Based upon these signals, the computer needs to provide a controlled driving force that will cause the turbine to rotate at a given speed - clearly the computer is not going to supply the Mega-Watts of mechanical power that are required to rotate the turbine. Rather, the "driving force" produced by the computer is a very low level electrical signal that is used to drive actuators, valves, etc. that control the flow of steam or water to the generator turbine. The problem is then how to convert the computer's controlling signals into some form of energy that can ultimately drive the external system.

Assuming then, that the computer circuits are unable to provide the required driving energy for an external system, there are a number of interfacing steps that may need to be carried out in order to achieve the required outcome. These include:

(i) Conversion of the computer's internal digital voltages to analog form
(ii) Amplification of the analog voltages to higher energy levels
(iii) Isolation of the computer circuits from the external system
(iv) Conversion from the analog voltage form to the required final energy
(mechanical energy, thermal energy, etc.).


Interfacing Computers Via Hardware


When we talk of interfacing computers to external systems, we are generally endeavouring to create closed control loops that enable a digital computer to generate (compute) some desired driving force, based upon the feedback obtained from the outside system. Sometimes, of course, we don't need a closed loop. This is particularly true if we only use a computer based device as a data logging or monitoring system, or if we use the computer to drive a system independently of the feedback (ie: as an open loop controller). However, regardless of the application, the same sorts of issues need to be addressed as a result of the incompatibilities between the "Newtonian-analog outside world" and the "digital computing world". The issues are shown schematically in the below Figure.


When observing the above Figure the most important point to understand is that modern computers will only respond to incoming digital voltage signals and will only generate outgoing digital voltage signals. The levels of these digital voltages are normally in the order of those shown for TTL circuits, although the actual levels depend upon the specific architecture of the digital circuits within the computer.
The alternative to generating accurate (expensive) circuits is digital computing, where we only allow electronic hardware to represent the binary numbers zero and one. Digital circuits allow us to carry out both arithmetic and a limited amount of human reasoning (tautology). The reasoning component is achieved by using zero to represent "false" or "off" and one to represent "true" or "on". The basis of digital circuits, and hence digital computing, is that voltage accuracy must not be permitted to dominate circuit design. As long as we can achieve voltages within certain ranges, then we can represent the only two numbers that we need to handle in digital computing.

The major design effort in the fabrication of digital semiconductor devices is therefore oriented towards achieving:

• High circuit speeds
• Small component sizes / High Component Density
• Low power dissipation
• Low circuit fabrication costs.

Figure (a) shows two, cascaded digital circuits, each with two inputs and one output. Figure (b) shows the allowable output and input voltage ranges for each of the circuits. An error margin exists between the output of one circuit and the input of the subsequent circuit, so that minor voltage variations that may occur do not affect the meaning of the information represented.





(a) Cascaded Digital Circuits.
(b) Allowable Input and Output Voltage Ranges for Transistor to Transistor Logic (TTL) Digital Circuits.

The actual digital voltage ranges shown in Figure (b) correspond to a family of digital circuits known as Transistor to Transistor Logic or TTL. This is the oldest of the widely used digital circuit technologies (dating back to the 1960s) and is important because most modern digital circuits are still designed with the same allowable input and output voltage ranges.

One of the major objectives of this blog is to help you to come to terms with the design of modern digital computer systems, so that you can understand why it is so difficult to interface them to the outside world. The strategy chosen in order to achieve this is to begin with an overview of the role of computers in the industrial arena, so that you may gain some insight into the range of performance attributes required by modern computers. The next stage in the process is to introduce (or rekindle) the basics of modern electronic circuits, including transistors, thyristors and so on. This serves two purposes. Firstly, it will help you to understand how both analog and digital circuits are designed and the limitations of those circuits. Secondly, it will introduce you to the basic elements used in interfacing computers to the outside world.



Analog and Digital Computation:

It is difficult to know whether the modern digital computer, and its Von Neumann architecture, were ever intended to interface to the real world. A computer is, by definition, a "reckoning machine" and certainly its original designers went to great lengths to make it into a device that could carry out repetitive computations and provide a limited amount of human reasoning. The analog computer, on the other hand, has always been closely associated with the control of physical systems, but has never been able to provide the reckoning ability that we associate with the digital computer. Analog computers no longer play any significant role in modern engineering, and so, this book is predominantly about digital computers and the problems that we face in connecting them to engineering systems.

It is interesting to note that when we use digital computers as islands of intelligence (that is, on their own), we find that their capabilities are only restricted by our own reasoning ability (that is, our ability to generate software) and by the speed at which computers can carry out the reasoning that we have instilled via our software. However, when we wish to interface computers to the real world (so that they can use their programmed reasoning to control a physical system) we find that our reasoning needs to be supplemented with an understanding of electronics, physics and engineering design principles before we can generate sensible solutions.

It is altogether likely that any computer programmer, with no knowledge of computer architecture or electronics, could create a working computer control system. Certainly, there are a sufficient number of commercially available, "black-box" solutions to assist in interfacing computers to external systems. The problem with using such solutions, without a proper understanding of the design principles behind them, is that sooner or later the seemingly minor problems that arise (system instability, unwanted spurious signals, irregular behaviour, etc.) become insoluble.

The first issue that really needs to be addressed is that of the digital and analog computing domains. In all our "Newtonian" time-frames, the world is essentially analog in nature. Physical quantities do not change from one energy level to another in zero time - there is normally a continuous transition from one state to another, rather than a quantum variation. One may well ask why, if the world is essentially analog, have we chosen to discard the concept of analog computing and replace it with digital (quantum) computing. There are many reasons why analog computers were discontinued in the 1970s. These include:

• Accuracy
• Size
• Power consumption
• Cost.

Underlying all the problems in analog computing is the issue of representing quantities accurately. Consider an analog computer that is required to take in two numbers (between zero and ten) and add them together to achieve a given result. How is this achieved? We could represent each of the inputs and outputs with a voltage and use a circuit to electrically add the inputs to provide the required output. This is shown in Figure:

we would assume that if Input A is equal to 5 volts and Input B is equal to 2 volts, then the output would be equal to 7 volts. What happens however, if:

• Input A = 5.001322447 volts
• Input B = 1.999933821 volts ?

The answer to this question really depends upon how accurately we can design and fabricate our analog addition circuit. In engineering, we know that accuracy in setting or measuring energy levels normally equates to higher complexity and higher cost. This is certainly true in electronic circuits.
An Overview of the Computer Interfacing Process:

A qualitative description and overview of the entire computer interfacing process (shown below). The analog and digital computing domains and the basis of digital circuit design. Steps in computer interfacing including hardware design phases and software issues.


bridged between modern electronic and mechanical equipment.


Computer Architecture and Interfacing to Mechatronic Systems



Very few systems in modern engineering are either purely mechanical or purely electronic in nature. Most engineering devices, machines and systems are a combination of mechanical elements, computer controls and the electronic interfacing circuitry that binds these elements together. In the mid-1980s, these hybrid systems were recognized as being a rapidly growing part of the engineering world and were given the rather commercial, but nonetheless appropriate, title of "mechatronic"systems. It is somewhat ironic that the two fields of engineering (electronic and
mechanical) that were derived from the classical mechanical engineering streams of the early 19th century have now had to be brought back together as a result of the growing need for mechatronic systems.

A mechatronic system can have many forms. At a domestic level, it could be a compact-disk player or a video recorder. At an industrial level, a mechatronic system could be a robot, a computer controlled production machine or an entire production line. The extraordinary increase in low-cost processing power that has arisen as a result of the microprocessor now means that few mechanical devices in the modern world are born without some form of intelligence.

The problem that most engineers now face is that their undergraduate courses have simply not equipped them to undertake the task of designing mechatronic systems. Mechanical and manufacturing engineers seldom understand enough about electronic engineering and computing concepts to tackle the inter-disciplinary realities of system design. Electrical and electronics engineers similarly understand very little about the mechanical systems for which they design computer controls and interfaces.

It is surprising therefore, that in this day and age we still retain separate courses
for electronic and mechanical engineering - and yet the trend towards greater specialization is unfortunately continuing. The common university argument is that in order to be a good electronic or mechanical engineer, one needs to have a highly specialized undergraduate program. The reality is that in order to be a good engineer, one needs to have a good understanding of both mechanical and electronic engineering disciplines and a degree of specialization that is born of practical realities, rather than esoteric theories.