2.7 Input and output considerations
So far in Section 2 I have focused on how the data is represented, or encoded, inside the weighing-scales computer. But how does it get into the computer? And how does it get out again in a form that users can recognise? These are big questions, and ones that later parts of the course will be going into in some detail. But I can sketch some answers here.
Weight is the most important input in the kitchen scales. To detect a weight, sensors are placed under the scalepan. They produce an electrical output whose magnitude depends on the magnitude of the weight in the scalepan. This electrical output is fed to the input subsystem. One of the tasks of the input subsystem is to sample the electrical output of the sensors and convert the value it finds to another electrical signal, one that is digital (and therefore quantised). The other task of the input subsystem is to encode this digital signal as a binary number which represents the weight.
A device that converts an analogue input to a digital output is called an analogue-to-digital converter or simply an A-D converter, and the conversion process is called analogue-to-digital conversion or simply A-D conversion. The input subsystem must therefore include an analogue-to-digital converter.
Other inputs to the scales come in the form of button presses. Button presses simply close an electrical contact (a switch) and so cause an electrical current to flow. The associated input subsystem encodes this accordingly, perhaps as a 0 for off (no current) and 1 for on (current flowing). The system will have a true/false quantity associated with each button, and will retrieve the value of this quantity from the appropriate input subsystem and store it for use.
The display panel is the most important output of the scales, and you saw in Section 2.6 how a set of true/false quantities representing the on/off states of a seven-segment display could be packed into a single 8-bit word. One such 8-bit word is associated with each seven-segment display on the display panel. All the processor has to do is set each 8-bit word to the correct pattern of 1s and 0s, and send them to the display's output subsystem. The display will then light up correspondingly.
The other output is a sound in the form of a simple beep. Once again a true/false quantity is used and its value is sent to the beeper's output subsystem to make the beeper sound or not sound, as appropriate.
Box 5: Transducers
A similar process to the one outlined above occurs when any analogue physical quantity is to be represented: a sensor will detect the magnitude of the physical quantity at any pre-determined instant and convert it to an analogue electrical value which is then fed to an analogue-to-digital converter. There are various types of sensors for converting physical quantities to electrical signals: not just for weight, but also for temperature, length, pressure, humidity, and so on. The name transducer is commonly given to such sensors.