Programming of Hardware Devices

Welcome! We will be your guides for this evening!


Input Data Stream from Sensor and Other Devices

Header Information

The information that is sent before the actual data, is known as the header. For communication between hardware devices within a computer system or hardware that is connected to one of its ports, the header is most usually a singular start bit. This bit signals to the receiving device that a new packet data is going to be sent, sort of as a forewarning so the system is able to receive the data.

Data Characters

Data Characters is known as the actual data within the stream of data that is currently being used by the receiving device. This includes instructions to be processed by the CPU and control characters. Control characters control what functions may occur when data is sent of received. Control characters are represented using ASCII values 0-31, they are typed while pressing the control key. Hardware devices need control structures to activate internal instructions, for example, a modem needs control structures to active the modem's internal functions, in certain situations it may dial a number or go offline.

Trailer Information

The information that is sent after the data is, is called the trailer information which error checks hits and stop bits. There are many different error checking techniques that can be used, and in most cases a simple parity bit is used. A stop bit is used to indicate the end of a data packet.

Hardware Specifications

Manufacturers have the responsibility to release hardware specifications that details their products nature and format of data streams that they send and receive. Also, the hardware specifications detail the required format that is used to control the device(s). It is then the responsibility of the developer to interpret and create these data streams correctly.

Processing of Data Stream

A data stream that is received from input devices which is then sent to output devices include two different types of information. These two different types of information are the header information, and the trailer information – which accompany the data itself when it is sent across a connection. This ensures that the data is sent correctly.

Generating Output to an Appropriate Output Device

Control Systems

A control system is a system that is made up of sensors that have the ability to obtain data from the outside environment and has actuators that are capable of performing output functions under the direction of an external controller, such as a user that oversees the actions of the system.
Concerning computer control systems, the controller is typically the computer system itself. The sensors provide the input to the system, the controller (computer system) processes the received input and directs the actuators into performing a physical task. There are two different types of categories of control systems which concern a computer system, they are 'open control systems' and 'closed control systems'.
An open control system is unable to react to its surrounding environment. An example would be, a hotel room lock on each room is activated using a magnetic swipe card rather than detecting whether or not the occupant is nearby.1

Printer Operations

ASCII Control Characters for Printers
Steps in the operation of a printer include:

  • A data stream from the printer is sent to the computer system through a printer port. The data stream tells the computer that the printer is online and ready to receive data.
  • A data stream is sent along the parallel lines to the printer, preceded by a strobe voltage signal to warn the printer to read the following data.
  • The printer sends a data stream to let the computer know when it is too busy too handle more data, there is a problem such as a paper jam or lack of paper or its buffer (storage area) is full.
  • Any data stream sent to the printer is acknowledged and clearance is given to send more data to the printer.2

Control Characters
Communication with Printers requires the use of specialized control characters to generate the correct responses from the printer. Many printers also use the control characters to indicate formatting changes such as page throw, font change and line spacing.3

A simple dot matrix printer uses the following codes (shown as hexadecimal numbers) to produce text on a page:
ASCII codes between 20 and 7F produce the appropriate characters.
ASCII codes below 20 are control codes.
ASCII codes above 7F have 80 subtracted from them before they are processed.

The control codes include
0D Carriage return (without line feed)
09 Line feed (without carriage return)
0F Form feed (start a new page)
Other codes, such as those for TAB are not included here.

Escape sequences are used to change text characteristics such as style, font and line spacing and for graphics.

To change font:
1B 46 nn (nn identifies the font )
00 is Courier, 01 is Arial, 02 is Geneva and 03 is Bookman

To change style:
1B 53 nn (nn identifies the style)
00 is plain, 01 is underlined, 02 is italic and 04 is bold.
Combinations of styles involve adding appropriate numbers.4

Specialist Devices with Digital Input and/or Output

There are a very large number of hardware devices available that directly transmit digital data to a computer system. These include MIDI (Musical Instruments Digital Interface), digital cameras, and digital screens.
The advantages of digital devices are seen in the interaction between these devices and the system. Because there is no need to convert the data there is less chance of errors, and the data transfer is faster. However, there are other problems to consider. An example is the use of the digital video camera. The digital audio-visual interface between hardware and software is complex. The digital audio-visual path must be capable of receiving many sub streams simultaneously, such as video, audio and data. The design of the hardware and software must ensure that the transfer does not interfere with the performance of applications running on the computer.5
Recently protocols have been established to enable digital data to be fed directly into the computer or received from the computer. The fire wire protocol (IEEE 1394 - IEEE 1394 is a serial bus interface standard for high speed communications and isochronous (means to occur at the same time or at equal time intervals) real-time data transfer, frequently used by personal computers, as well in digital audio, digital video, automotive and aeronautics applications.6) developed by Apple is one popular standard that allows data to be transmitted directly from a digital source to the computer. A perfect digital copy is made with no conversion losses. Digital cameras, digital videos, MIDI, hard drives and printers can all be connected digitally7.
Digital data transfer allows for data to be accurately transmitted without conversion losses created by analogue to digital and digital to analogue converters.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License