Upload
gavhays
View
4.514
Download
0
Embed Size (px)
Citation preview
Software Developers View of Hardware
Programming Hardware Devices
What does this mean?
Computers usually interact with outside sources for input and output: CD-ROM Mouse Keyboard Scanner Monitor.
What does this mean?
Most software developers require their software to interact with these devices.
So it is therefore important to understand how they are programmed and especially, how they operate.
Any hardware device that can be programmed uses two processes: Sensor Actuator
Sensor
Any device that converts input from the environment into a digital signal.
The signal is then interpreted by the software.
Actuator
An output device that performs a mechanical action.
Actuators receive digital signals from software.
Processing a Data Stream
What is a Data Stream? A packet of binary data consisting of a
header, data characters and a trailer. For example:
Header Data Trailer
010101 | 101010100 | 0101010 The information contains the data and a
check to see if it is correct.
Processing a Data Stream
What is in the header? Specifies how much data is to be
transmitted. Contain error checking data such as:
Parity Checking CRC 16
Specifies the device in which it is coming from.
Processing a Data Stream
What is in the data section? Includes control characters i.e SHIFT + B All subsequent instructions to be processed
by the CPU.
Processing a Data Stream
What is in the trailer section? Data bits that end the block. Error checking bits Memory clear instructions.
Processing a Data Stream
1. Recognising and stripping control Characters
Control characters are represented by the ASCII values 0 – 31 and are typed while pressing the control key.
Processing a Data Stream
2. Counting the Data Characters The header field will normally contain all
required information relating to the size of data packets.
Processing a Data Stream
3. Extracting Data Once the header and trailer have been
removed, the hardware within the CPU will extract the data, and relevant software will carry out the instructions.
Keyboard Example
How a keyboard transmits data? Pressing a key causes a change to take
place in the amount of current flowing through key circuits.
A microprocessor sends a signal relating to the pressed key along a cable port notifying the BIOS.
Keyboard Example
The BIOS translates the codes into ASCII and that particular character or command is stored in memory.
Control Systems
These are systems that include hardware devices, software and especially the use of sensors and actuators.
There are two broad categories of control systems:
Open Control Systems Closed Control Systems
Open Control Systems
These systems do not react to their environment.
These systems normally require a user to activate the actuator.
E.g. Hotel Door Lock.
Closed Control Systems
These systems actually react to their environment.
This system uses sensors and programmed structures to control the actuators.
For Example: Anti-Lock Breaking System
Question 1
A robotic moon car is designed to use digital controls. The motor of the car receives the following commands from a user.
->H Header
<-T Trailer
StraightX Moves in straight line at X speed.
RightX Turns right X deg
LeftX Turns left X deg
Stop Motor off.
Question 1
The speed for the car can range from + 100 (Fastest) to -100 (Backward)
1.) Identify the category of control system.
2.) Identify the problems with the following instruction:
->HStraight20StopRight90Forward10->H
3.) Construct a data stream to carry out the following tasks: Move forward 30 Move left 45, move forward 80 Move right 20, backward -20, stop
Question 2
Complete the following text book questions:
SET 10F
Question 11
Question 13
Question 14