20
Software Developers View of Hardware Programming Hardware Devices

Programming Hardware Devices

  • Upload
    gavhays

  • View
    4.514

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Programming Hardware Devices

Software Developers View of Hardware

Programming Hardware Devices

Page 2: Programming Hardware Devices

What does this mean?

Computers usually interact with outside sources for input and output: CD-ROM Mouse Keyboard Scanner Monitor.

Page 3: Programming Hardware Devices

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

Page 4: Programming Hardware Devices

Sensor

Any device that converts input from the environment into a digital signal.

The signal is then interpreted by the software.

Page 5: Programming Hardware Devices

Actuator

An output device that performs a mechanical action.

Actuators receive digital signals from software.

Page 6: Programming Hardware Devices

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.

Page 7: Programming Hardware Devices

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.

Page 8: Programming Hardware Devices

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.

Page 9: Programming Hardware Devices

Processing a Data Stream

What is in the trailer section? Data bits that end the block. Error checking bits Memory clear instructions.

Page 10: Programming Hardware Devices

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.

Page 11: Programming Hardware Devices

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.

Page 12: Programming Hardware Devices

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.

Page 13: Programming Hardware Devices

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.

Page 14: Programming Hardware Devices

Keyboard Example

The BIOS translates the codes into ASCII and that particular character or command is stored in memory.

Page 15: Programming Hardware Devices

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

Page 16: Programming Hardware Devices

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.

Page 17: Programming Hardware Devices

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

Page 18: Programming Hardware Devices

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.

Page 19: Programming Hardware Devices

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

Page 20: Programming Hardware Devices

Question 2

Complete the following text book questions:

SET 10F

Question 11

Question 13

Question 14