Course Profile Computer Engineering, Grade 11,
University/College Preparation, Catholic and Public
Unit
5: Computer Interfacing
Time: 30 hours
Activity 1 | Activity 2
| Activity 3 | Activity 4
| Activity 5
Students
design, build, and operate interfacing systems. Students apply and integrate
their hardware and software knowledge from the previous four units in designing
and building systems for communicating between the computer and peripheral
devices. Students also research the social impact of hardware development and
identify related engineering careers. Students also explore the possibilities
for solutions to social and environmental moral and ethical problems through
computer technology.
|
Activity |
Time |
Expectations |
Assessment |
Tasks |
|
1. What
is Interfacing? |
1 hour |
TVF.01,
TF2.01, CGE2b,
CGE2e, CGE3f, CGE7i, CGE7j |
Knowledge/
Understanding |
Identifying
interface hardware and software components and terminology. |
|
2.
Interfacing Software |
6 hours |
TVF.05,
TF1.02, SPV.01, SP1.01, SP3.01, SP3.02, CGE3b,
CGE3c, CGE4f |
Thinking/Inquiry
Application |
Applying
computer programming concepts of Unit 4 to the software needed for particular
interfacing systems. |
|
3.
Interfacing Hardware Design |
5 hours |
TVF.01,
TF2.02, SP2.02, CGE3b,
CGE4f |
Knowledge/
Understanding Thinking/Inquiry |
Students
design hardware interfaces and peripherals for the interfacing systems to be
built in Activity 4. |
|
4.
Building, and Operating an Interface System |
15 hours |
TVF.01,
TF2.02, SPV.02, SP1.03, SP2.01, SP2.02 CGE3b,
CGE3c |
Application
Communication |
Construct
and operate entire interfacing systems. Include programming software and
design work in portfolio. |
|
5.
Impact of Computer Technology and Related Careers |
3 hours |
ICV.03,
ICV.04, IC1.02, IC1.03, IC1.05, IC1.06, IC1.07 CGE3b,
CGE3f, CGE4f, CGE5a |
Thinking/Inquiry
Communication |
Explore
the social impact of computer technology and career opportunities in
engineering. |
Time: 60 minutes
Students are introduced to the electronic
hardware and software components of commercial and hand-built interfacing
systems. Students explore possible project ideas through investigation and
research, leading to their own computer interface system. Students also explore
ethical and moral use of computer technology as caring stewards of society and
the environment.
Strand(s): Theory and
Foundation
Overall
Expectations
TVF.01 -
identify the function and interaction of basic computer components and
peripherals.
Specific
Expectations
TF2.01 -
explain the function and interaction of the basic components (e.g., CPU, I/O
devices, memory) of a computer system;
Ontario
Catholic School Graduate Expectations
CGE2b -
reads, understands and uses written materials effectively;
CGE2e -
uses and integrates the Catholic faith tradition, in the critical analysis of
the arts, media, technology, and information systems to enhance the quality of
life;
CGE3f -
examines, evaluates and applies knowledge of interdependent systems (physical,
political, ethical, socio-economic and ecological) for the development of a
just and compassionate society;
CGE7i -
respects the environment and uses resources wisely;
CGE7j -
contributes to the common good.
·
hardware
familiarization from Unit 1
·
networking
terminology from Unit 2
·
hands-on
integrated circuit activities from Unit 3
·
Review
programming software basics to control interfaces (introduced in Unit 4).
·
Catalogue
on-hand electronic components to build interfaces and peripherals (see Activity
4).
·
Review
software to design interfacing circuits.
·
Organize
this activity considering hands-on work in Activity 4.
1. Teacher initiates discussion on ethical
design practices and make students aware of responsibility to promote Christian
values and ensure ethical and socially responsible use of computer technology
in society. Situations to consider include: intellectual property rights and
illegal copying of software, reverse engineering, creation and distribution of
viruses or other destructive devices, computers and privacy issues,
environmental impact of computer technology (good or bad).
2. Students develop a list of responsible
computer (and interface) use to be written on chart paper and displayed in
class. (Possible uses include alarms and other safety devices, devices to
assist people with special needs, early warning systems for navigation or
shipping, devices that improve the workplace by reducing or eliminating menial
tasks).
3. Review the safety considerations when working
with computer internals and with electronic components.
4. Introduce
the types of small- and large-scale interfaces. (An example of a small-scale
interfacing system could be a computer controlling a single LED, a large scale
interfacing system could be a computer controlling a robot).
5. Other interfacing systems that might be
considered are:
·
three
LEDs simulating a stop light
·
twelve
lights simulating traffic control at an intersection
·
eight
lights demonstrating counting from 0 to the maximum value stored in one byte
(i.e., 255)
·
eight
lights demonstrating the binary ASCII values of any character
·
simulation
of stereo indicator lights
·
multiple
LEDs demonstrating seven segment displays
·
simulation
of safety or warning indicator lights
·
one
DC motor
·
one
DC motor installed in a vehicle
·
one
motor installed in a toy ( e.g., merry-go-round)
·
multiple
motors
·
combinations
of lights and motors (e.g., amusement park rides).
6. Outline the organization of the main
interfacing components (computer, interface, peripheral) using precise
terminology (Refer to Activity 3 and 4 in the Grade 10 Computer Engineering
Profile).
7. Students should complete the knowledge-building
exercise (Appendix 5.1.1 – Discrete Electronic Components) to familiarize
themselves with discrete electronic components and their function.
8. Demonstrate how the computer communicates
with the interface using the discrete electronic components.
Develop
rubric to assess the student’s proper identification of electronic components.
·
Review
vocabulary and definitions prior to and in context of lesson when necessary.
·
Monitor
individual submissions and progress to allow extra time or further review work
as needed.
·
Allow
for oral testing (vs. written testing) for students with special needs when
measuring skill and ability.
·
Make
appropriate accommodations based upon recommendations in exceptional students’
IEPs.
Software
Ministry
licensed word processor or spreadsheet.
Print
Barbarello,
James. Real World Interfacing with Your PC. Indianapolis: Howard W. Sams
& Co., 1996.
ISBN 0-7906-1145-7
Bergsma,
Paul. Controlling the World with Your PC. California: High Text
Publications Inc., 1994.
ISBN 1-878707-15-9
Simms,
Forrest. Getting Started in Electronics. USA: Radio Shack, 1983. Cat No
276-5003
Smyth,
Graham and Christine Stephenson. Computer Engineering: An Activity-Based
Approach. Toronto: Holt Software Associates, 2000. ISBN 0-921598-36-X
Individual
electronic components such as LEDs, resistors, transistors, small DC motors and
breadboards must be clearly understood before complete interfacing systems can
be built. Define the following interface terminology by reading the
specifications on the component packages, accessing Internet electronic
terminology sources, and/or reading computer programming software manuals or
obtaining resource material from your teacher.
1. An acronym is a word formed from the initial
letter(s) of words (e.g., CPU is an acronym for Central Processing Unit, LORAN
is an acronym for LOng RAnge Navigation). What is LED an acronym for?
2. a) Draw
a physical diagram of an LED and label the positive and negative leads.
b) Draw an electronic schematic
of an LED.
3. Compare the lengths of the two leads. How is
the positive lead on an LED distinguished from the negative lead?
4. Examine the base of an LED. One side of the
base is slightly flattened. Which lead is associated with the flattened side?
5. What is the maximum voltage required by an
LED?
6. What is the voltage output from the parallel
port output pins?
7. a) Describe
the exterior physical characteristics of a resistor.
b) Draw an electronic schematic
of a resistor.
8. What units are used to measure resistance?
9. Using a chart of resistor values, state the
value of the resistor given the state of the three colour bands.
a) Red, red, brown
b) Orange, orange, brown
c) Red, black, red
d) Orange, yellow, green
10. Given the following resistor values in ohms,
describe the three colour bands on the resistor.
a) 220
b) 330
c) 500
d) 5 300 000
11. What is a breadboard?
12. Draw a labelled diagram of a breadboard that
includes:
a) top horizontal bar
b) bottom horizontal bar
c) centre dividing line
d) vertical connecting columns
e) describe which groups of holes
in the breadboard are connected internally.
Time: 300 minutes
Students
develop software for controlling computer interfaces. The software that
students design and write in this activity leads to the fabrication of an
interfacing system in Activity 4. This software will control input and output
of a system consisting of a computer, interface, and a hardware device.
Students consider the care of systems and facilities in light of the common
good.
Strand(s): Theory and Foundation,
Skills and Processes
Overall
Expectations
TVF.05 -
describe a problem-solving model and the fundamental programming constructs
required to implement it.
SPV.01 -
use internal numbering, character representation systems, and logic gates.
Specific
Expectations
TF1.02 -
identify standard ways of representing characters (e.g., ASCII, EBCDIC).
SP1.01 -
perform base-to-base conversions;
SP3.01 -
use design tools to plan programming solutions (e.g., flow charts, pseudo-code,
structure charts);
SP3.02 -
apply fundamental programming constructs by writing, testing, and debugging
programs.
Ontario
Catholic School Graduate Expectations
CGE3b -
create, adapt, and evaluate new ideas in light of the common good;
CGE3c -
think reflectively and creatively to evaluate situations and solve problems;
CGE4f -
apply effective communication, decision-making, problem-solving, time and
resource management skills.
·
Select
suitable programming software (e.g., Turing, Visual Basic) that
supports access to the parallel port and possible graphics and mouse control as
enrichment activities (see Appendix 5.3.4. – Enrichment Mouse Activities).
·
During
this programming activity consider the construction of the interfacing system
in Activity 4.
·
Consideration
must be given to possible conflicts between the operating system software and
programming software as to which has control of the parallel port.
·
Consideration
must also be given to possible problems when students have access to the
operating system while programming. For example, students can format drives,
add or remove programs, send data that will control inappropriate hardware such
as projectile launchers. One approach would be to obtain from business,
industry or academic institutions a set of older computers. These computers can
be assembled/disassembled and have operating and network software
installed/removed with no disruption to the main school network. If
appropriate, groups could be assigned the same computer for a block of time and
hence assure continuity of a project.
·
Unit
3, hands-on integrated circuit activities
·
Unit
3, number system arithmetic and conversions
·
Unit
4, computer programming activities
1. Teachers review base 10, hexadecimal and
binary number system conversions as appropriate to the programming language
selected (see Appendix 5.2.1 – Number Systems and Appendix 5.2.2 – Binary
Representation of Numbers).
2. Students apply the software concepts from
Unit 4 to include interface commands to turn a simple LED on and off through
the parallel port (see Activity 3, Appendix 5.3.1 and Appendix 5.3.2 for
programming considerations).
3. Review programming style introduced in Unit 4
when writing programs (including program identification, proper indentation,
and documentation).
4. Teachers review each fundamental programming
structure (to include input/output, decision, and looping) as necessary to
control the interface.
5. Students write programs that apply character
representation systems such as ASCII. For example, in Turing, the command put
ord (“A”) will display the number 65 on the screen since 65 is the ASCII
equivalent of A. These commands can be used in programs to explain how all
characters are assigned specific numbers that can be represented in base 10,
binary or hexadecimal.
Students
are assessed on test(s) or assignment(s) that include the use of proper
programming style and structure. Students are evaluated on Appendices 5.2.1,
5.2.2
·
Provide
printed materials such as examples of programs that demonstrate interfacing
concepts or additional help with problem solving model examples when necessary.
·
Adapt
time constraints on the programming test when necessary.
·
Pair
students to accommodate need for remediation or enhancement.
·
Incorporate
mouse control and graphics as possible enrichment assignment (Appendix 5.3.4 –
Enrichment Mouse Control).
·
Make
appropriate accommodations based upon recommendations in exceptional students’
IEPs.
Software
Computer
programming software (possibly same software used in Computer and Information
Science).
Print
Barbarello,
James. Real World Interfacing with Your PC. Indianapolis: Howard W. Sams
& Co., 1996.
ISBN 0-7906-1145-7
Bergsma,
Paul. Controlling the World with Your PC. California: High Text
Publications Inc., 1994.
ISBN 1-878707-15-9
Smyth,
Graham and Christine Stephenson. The Don’t Panic Guide to Programming.
Toronto: Holt Software Associates, 1999. ISBN 0-921598-33-5
Smyth,
Graham and Christine Stephenson. Computer Engineering: An Activity-Based
Approach. Toronto: Holt Software Associates, 2000. ISBN 0-921598-36-X
Websites
Turing
and OOT – http://www.holtsoft.com/turing/resources.html
The QBasic
Page – http://www.qbasic.com/qbindex.shtml
An
interfacing system consists of a computer, interface, and peripherals. The
computer is able to communicate with the interface through the parallel port. The
computer sends commands (signals) to the parallel port using a programming
language. The programming language uses either a base 10 or a hexadecimal
number system (depending on the language) when communicating with the parallel
port. The software can be written in any of several languages (such as Visual
Basic, Turing and Pascal). All languages eventually translate
their numbering system to binary at the parallel port. Therefore an
understanding of the relationships among binary, hexadecimal, and base 10 is
essential. The language chosen should easily communicate with the parallel port
and possibly support graphics and access the mouse commands as enrichment
activities.
By
answering the following questions, students should gain a better understanding
of how the software communicates with the interface. See for reference the
software-programming manual, software websites, and material listed in
Resources.
1. Since the source code for programming
languages uses either base 10 or hexadecimal when sending the parallel port
commands, conversions among the three systems should be understood. Complete
the following chart that relates binary, decimal, and hexadecimal systems.
|
Base 10 (Decimal) |
Base 16 (Hexadecimal) |
Base 2 (Binary) |
|
0 |
|
|
|
1 |
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
Base 10 (Decimal) |
Base 16 (Hexadecimal) |
Base 2 (Binary) |
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
2. Larger binary, hexadecimal, and decimal
numbers must also be converted so they can be used when communicating with the
parallel port. Complete the chart.
|
Question No. |
Binary number |
Decimal number |
Hexadecimal number |
|
1 |
1111 |
|
|
|
2 |
1010 1111 |
|
|
|
3 |
|
255 |
|
|
4 |
|
128 |
|
|
5 |
|
|
11 |
|
6 |
|
|
FF |
3. How
many pins on the parallel port are normally reserved for outputting data?
4. What
is the smallest number that can be output on the parallel port in base 10, 2,
and 16?
5. What
is the largest number that can be output on the parallel port in base 10, 2,
and 16?
6. When a Base 10 number is sent to the parallel
port, the binary equivalent is actually output on pins labelled D0, D1, D2 …
D7. Complete the chart that relates the Base 10 number and the equivalent
number on the output pins of the parallel port.
|
Number |
D0 |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
|
1 |
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|
|
|
|
255 |
|
|
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
|
Some
programming languages use the hexadecimal number system in the programming language
to send information to the parallel port. The information at the parallel port
has been translated to binary by the programming language being used. This
sheet examines the relationship between binary, decimal, and hexadecimal number
systems
Memory
is used to store information inside the computer. Computer memory is divided
into bits and bytes (8 bits). Each bit is a one or a zero; the combination of
ones and zeros in a byte would allow the storage of letters and numbers.
One byte
can store a number up to 255. The following is a representation of a byte:
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
0 |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
Each bit
represents a power of 2 just as in our number system each digit represents a
power of 10. All the numbers between 0 and 255 can be represented as a
combination of bits. The number above is 105 or 64+32+8+1.
1. What numbers are each of the following?
a)
|
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
b)
|
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
c)
|
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
d)
|
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
2. Determine the bit pattern for each of the
following numbers
a)
|
43 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
|
|
|
|
|
|
|
b)
|
107 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
|
|
|
|
|
|
|
c)
|
231 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
|
|
|
|
|
|
|
d)
|
85 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
|
|
|
|
|
|
|
Time: 240 minutes
Students
design a hardware interface and related peripherals using a computer science
problem-solving model. Students learn to design interfacing systems based on
given situations, ranging from simple LED lights to more complex motor
controllers. Design decisions based on ethical and moral use of computer
technology is stressed.
Strand(s): Theory and Foundation,
Skills and Processes
Overall
Expectations
TVF.01 -
identify the function and interaction of basic computer components and
peripherals.
Specific
Expectations
TF2.02 -
describe the function and interaction of computer peripherals (e.g., mouse,
keyboard, screen, printer).
SP2.02 -
verify the correctness of the input and output of a system consisting of a
computer, interface, and a hardware device.
Ontario
Catholic School Graduate Expectations
CGE3b -
create, adapt, and evaluate new ideas in light of the common good;
CGE4f -
apply effective communication, decision-making, problem-solving, time and
resource management skills.
·
Computer
hardware component background from Unit 1
·
Hands-on
integrated circuit activities from Unit 3
·
Understanding
of electronic components discussed in Unit 5, Activity 1
·
Initial
interfacing systems should be based on controlling LEDs since they are
versatile, inexpensive, and expandable. A simple one LED system can be expanded
to three LEDs simulating a stoplight, or twelve lights simulating traffic
control at an intersection, or eight lights demonstrating binary counting and
binary ASCII character representations, or multiple LEDs simulating stereo
indicator lights. A simple DC motor interfacing system can be used as in a
vehicle or other toy such as a merry-go-round. Combinations of lights and
motors can simulate amusement park rides. Subsequent interfacing systems could
control several motors that can be expanded into computer-controlled cars or
robots.
·
Select
suitable method to design interfacing hardware (e.g., pencil/paper,
computer-assisted design). Initial designs should be sketched with
pencil/paper.
·
Design
must take into consideration the availability of electronic components.
·
During
the design activity, consider possible projects for Activity 4 such as light
controls (low voltage LEDs), motor controls (low voltage DC), or construction
and control of small vehicles or robots. Start by mounting one LED on a
breadboard and writing software that will flash the LEDs in repeat patterns or
output Morse code signals. In a similar fashion three LEDs can be mounted on a
small stand to simulate traffic lights.
·
Design
considerations should include possible coordination with other Technological
Studies subjects to assist in fabrication of the peripheral system (i.e.,
construction or manufacturing shop).
1. Teachers review ethical issues discussed in
Activity 1.
2. Teachers should review safety considerations
when handling electronic hardware.
3. All designs should follow from the simple (e.g.,
one LED) to the complex (e.g., motors and lights), each design based on
previous accomplishments.
4. Teachers outline the function of an interface
in an interfacing system (Refer to Appendices 5.4.2 and 5.4.3 of the Grade 10
Computer Engineering Profile)
5. Teachers review discussions on how
information flows into and out from the interface, and various electronic
components used in interface fabrication.
6. Students design interfaces (Refer to the
Grade 10 Profile, Appendix 5.4.2 – Interfacing one Bit, and Appendix 5.3.2 –
Interfacing one Byte, and Appendices 5.3.1 to 5.3.4 of this profile).
Students
are assessed and evaluated on quality and demonstrated learning of their
assignment on design of an interfacing system that controls a peripheral such
as a light, combination of lights, a small DC motor, several motors, small
vehicle, or robot.
·
Teachers
should select the level of difficulty of the assignment based on individual
student level of comprehension and background.
·
Students
with experience in the TEE2O Engineering course will be familiar with basic
interface design and therefore require less review of basic concepts and could
assist other students.
·
More
advanced designs can be used as enrichment projects.
·
Make
appropriate accommodations based upon recommendations in exceptional students’
IEPs.
Software
Computer
programming software
Print
Barbarello,
James. Real World Interfacing with Your PC. Indianapolis: Howard W. Sams
& Co., 1996.
ISBN 0-7906-1145-7
Bergsma,
Paul. Controlling the World with Your PC. California: High Text
Publications Inc., 1994.
ISBN 1-878707-15-9
Powers,
Thomas. The Integrated Circuit Hobbyist’s Handbook. California: High
Text Publications, Inc., 1995. ISBN 1-878707-12-4
Smyth,
Graham and Christine Stephenson. Computer Engineering: An Activity-Based
Approach. Toronto: Holt Software Associates, 2000. ISBN 0-921598-36-X
Websites
Parallel
port Central – http://www.lvr.com/parport.htm
Turing
and OOT – http://www.holtsoft.com/turing/resources.html
The
QBasic Page – http://www.qbasic.com/qbindex.shtml
The
student must understand the configuration of the parallel port in order to use
it to control peripherals. The following questions attempt to clarify the
specific function and naming of individual pins on the parallel port. Refer to
computer software manuals, websites, and other material from Resources.
1. What is one purpose of the parallel port?
2. Where is the parallel port located?
3. How many pins are located on the parallel
port?
4. Draw a diagram of the parallel port as viewed
from the back of the computer. Number all pins.
5. How many pins are output pins?
6. Which pins function as grounds?
7. What is the pin number of the first output
pin? This pin is traditionally named D0.
8. The output pins are traditionally labelled
D0, D1, D2, … and D7, and have associated pin numbers. Complete the following
chart.
|
Parallel port Pins |
||||||||
|
Pin
label |
D0 |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
|
Pin
number |
|
|
|
|
|
|
|
|
9. Generally a parallel cable connects the
parallel port in the back of a computer to a printer. Parallel cables can be custom-built
for applications beyond computer/printer connections. What is the name of the
connector at the end of a parallel cable that plugs into parallel port?
10. Describe how wires can be attached to the
parallel port.
11. What command(s) will send information to the
parallel port in the language you are using.
12. Write a program that will allow the user to
send a high or a low signal to a peripheral.
13. Write a program that will count from 0 to 255
and send each of these numbers in binary form to eight LEDs.
14. Write a program that will allow the user to
enter a character and output that character in ASCII to eight LEDs.
15. Write a program that will allow the user to
enter their name. The program should send each ASCII value in their name to
eight LEDs.
16. A traditional interfacing system is composed
of a computer, an interface, and a peripheral. A very simple interfacing system
could be used to control an LED. In this kind of interface, the computer would
be connected to the peripheral (LED) by two wires that run from the computer,
via the parallel port, to the peripheral.
In more
sophisticated interfacing systems, where higher voltage lights or motors are
being controlled, the interface could consist of many electronic components. List
five other interfacing systems and in each case name the peripheral being
controlled.
Visual
Basic does not
support access to the parallel port directly. A separate dll file must be
included with the Visual Basic program to permit input and output from
the parallel port.
Documentation
for inpout32.dll when using Visual Basic.
Source:
www.lvr.com/parport.htm
Inpout32
is a DLL that enables direct reading and writing to I/O ports in 32-bit Visual
Basic programs.
by Jan
Axelson (email: jaxelson@lvr.com)
Important information and cautions
1. Inpout32 was developed to allow access to
parallel ports and other ports on custom hardware, but you can use it to
attempt to access any hardware that is mapped as an I/O port. Health and safety
precautions when handling any electronic components must be observed.
2. Use this DLL only with 32-bit programs.
16-bit programs require a 16-bit DLL.
3. Windows 95 allows direct port reads and
writes unless a Vxd has control of the port and blocks access. Under Windows
NT, direct port access is not allowed, and you must use a kernel-mode device
driver.
4. For the latest parallel-port programming and
interfacing information, visit Parallel Port Central at: http://www.lvr.com
These
are the inpout32 files
·
inpout32.dll
A DLL that adds Inp and Out to 32-bit Visual Basic 4 programs.
·
inpout32.bas
Visual Basic declarations for Inp and Out
·
inpout32.vbp
Visual Basic 4 test program for inpout32
·
inpout32.frm
Startup form for the test program
·
inpout32.dpr Source code for inpout32.dll. The DLL was
compiled with Borland’s Delphi 2.0 Object Pascal compiler.
How to
use inpout32
1. Copy inpout32.dll to one of these locations:
your default Windows directory (usually\Windows), your Windows system directory
(usually \Windows\system), or your application's working directory.
2. Add inpout32.bas to your Visual Basic project
(File menu, Add File).
3. Use this syntax to write to a port: Out
PortAddress, ValueToWrite (Example: Out
&h378, &h55 )
4. Use this syntax to read a port: ValueRead =
Inp(PortAddress) (Example: ValueRead =
Inp(&h378) )
(The
syntax is identical to QuickBasic’s Inp and Out).
How to
run the test program (inpout.vbp)
1. Copy inpout32.dll to your default Windows directory
(or other directory as described above).
2. Open the project inpout32.vbp.
3. In the Form_Load subroutine, set PortAddress
equal to the port address you want to test.
4. Clicking the command button causes the
program to write a value to the port. Each click increments the value,
resetting to 0 at 255.
DC
Motor Interface Design
Purpose: To design the interface that will
receive signals from the computer and translate them into signals for the
peripheral (in this example, it is the motor).
Theory: D0 is the first output pin on the
parallel port. By setting it high, the base pin of the transistor (here a
TIP31) will be set high. This will permit electrons to flow from the ground to
the +5V through the motor. The motor will therefore turn on. By setting D0 low,
the motor will turn off. The 1K resistor will reduce the current to the base of
the transistor since the base current requirements are low.

Safety
Note 1: The voltage
requirements of the motor and the power supply (here +5V) should be matched.
Safety
Note 2: The voltage
and current requirements of the motor must not exceed the capabilities of the
transistor.
Mouse
Control – Enrichment
Mouse
and graphic commands are interrelated. The graphic commands are useful for
displaying diagrams that represent the actual real-world peripheral being
controlled by the computer. The mouse commands are also useful for selecting
graphic options displayed on the screen. When an option is selected by
clicking, the software takes appropriate action and sends commands through the
parallel port. The real-world object being controlled is activated at the same
time as the screen graphic. Graphical user interfaces (GUIs) are very popular
commercially.
A
graphical interface can make an interfacing project easier to operate. A mouse
clicking on a graphic to activate the peripheral is easier to use than a
text-based system. This is similar to the advantage the Windows operating
system (a graphics based interface) has over DOS (a character based system).
1. Write a program to display the representation
of a motor on the screen.
2. Write a program to represent the motor
turning clockwise for three seconds and then stopping.
3. Write a program that represents the motor
turning clockwise for three seconds and then turning off for two seconds. This
process should repeat 20 times.
4. Write a program that displays four small
boxes and the motor on the screen. The first box contains the word CLOCKWISE.
The second box contains the words COUNTER CLOCKWISE. The third box contains the
word STOP. The fourth box contains the word EXIT. The program should turn the
motor clockwise when the first box is clicked, counter clockwise when the
second box is clicked; stop when the third box is clicked and exit the program
when the fourth box is clicked.
Time: 900 minutes
Students
integrate knowledge of software, hardware theory and practice gained from the
previous activities to build and operate complete interfacing systems. They
adapt their understanding of troubleshooting, hardware configuration, and
computer programming to solve challenges in a wide variety of computer
interfacing and computer-based mechanism situations. Activities 4 and 5 are culminating
activities for the course. The ethical use of computer technology to improve
life is reinforced.
Strand(s): Theory
and Foundation, Skills and Processes
Overall
Expectations
TVF.01 -
identify the function and interaction of basic computer components and
peripherals;
SPV.02 -
construct systems that use computer programs to interact with hardware
components.
Specific
Expectations
TF2.02 -
describe the function and interaction of computer peripherals (e.g., mouse,
keyboard, screen, printer);
SP1.03 -
build an interface that visually displays internal representations of numbers
and characters;
SP2.01 -
build interfaces that control hardware components (e.g., LEDs, direct current
motors, and stepper motors);
SP2.02 -
verify the correctness of the input and output of a system consisting of a
computer, interface, and a hardware device.
Ontario
Catholic School Graduate Expectations
CGE3b -
create, adapt, and evaluate new ideas in light of the common good;
CGE3c -
think reflectively and creatively to evaluate situations and solve problems.
·
Unit
1, hardware components
·
Unit
3, integrated circuits to build the interface
·
Unit
4, programming background to write software
·
Unit
5, Activity 2, interfacing software application
·
Unit
5, Activity 3, interface design concepts
·
Plan
suitable interfacing projects such as interfacing a light, combination of
lights, traffic lights (scale model or real-world, a DC motor, several motors, small
vehicle, or a robot).
·
Consideration
must be given to the opportunities and limitations of available hardware and
software.
·
Consider
ethical issues that may emerge during these projects (such as taking credit for
work done by others, using components that belong to others, or suitability of
final project to the common good).
·
Gather
pricing information for electronic components required when assemble interfaces
and peripherals.
1. Teachers
review safety precautions when handling computer and electronic components
(Appendix 1.1.2 from the Grade 10 Computer Engineering Profile).
2. Relate the concepts of current flow and
complete circuits to their background in elementary science classes or in
secondary school, General Science in Grade 9 or electricity in Physics or
electricity/electronics in Broad-based Technology.
3. Teachers initiate discussions on specific
hardware and software components of an interfacing system (Appendices 5.1.1,
5.4.1, and 5.4.2).
4. Teachers initiate review discussions on how
software and hardware components communicate (Appendices 5.4.1 and 5.4.2).
5. Students relate the electronic components
from Activity 1, interfacing software of Activity 2, and interfacing hardware
design of Activity 3 to the building of a complete system where hardware
communicates with software (Appendices 5.4.1 and 5.4.2).
6. Students develop a complete interfacing
system by relating the hardware components from Unit 1, the necessary network
concepts from Unit 2, the integrated circuits from Unit 3, the computer
programming from Unit 4, and the design and programming of interfaces from Unit
5. Systems can be developed individually or in groups.
7. Test and trouble shoot each step along the
project (Appendix 5.4.3).
8. Teachers facilitate the building of a
complete interfacing system (Appendix 5.4.1 – Interfacing a DC Motor and
Appendix 5.4.2 – Interfacing LEDs Using Visual Basic).
·
Projects
are assessed on organization, accuracy, completeness, neatness, documentation,
and originality, with consideration of level of difficulty and effort.
·
Student
leaders with a higher level of interfacing experience could be paired with
classmates requiring remedial work or extra assistance to promote a positive
accepting environment.
·
Students
requiring enrichment programming and interfacing could develop additional GUI
and mouse control options for their interfacing system (Appendix 5.2.5 –
Enrichment Mouse Control).
·
Make
appropriate accommodations based upon recommendations in exceptional students’
IEPs.
Software
Computer
programming software
Print
Axelson,
Jan. Parallelport Complete. Wisconsin: Lakeview Research, 1998. ISBN
096508191-5
Barbarello,
James. Real World Interfacing with Your PC. Indianapolis: Howard W. Sams
& Co., 1996.
ISBN 0-7906-1145-7
Bergsma,
Paul. Controlling the World with Your PC. California: High Text
Publications Inc., 1994.
ISBN 1-878707-15-9
Lawrence,
Orville. Computer Technology. Toronto: McGraw-Hill Ryerson, 1984. ISBN
0-07-548711-X
Powers,
Thomas. The Integrated Circuit Hobbyist’s Handbook. California: High
Text Publications, Inc., 1995. ISBN 1-878707-12-4
Simms, Forrest. Getting Started in
Electronics. USA: Radio Shack, 1983. Cat No 276-5003
Smyth, Graham and Christine Stephenson. The
Don’t Panic Guide to Programming. Toronto: Holt Software Associates, 1999.
ISBN 0-921598-33-5
Smyth,
Graham and Christine Stephenson. Computer Engineering: An Activity-Based
Approach. Toronto: Holt Software Associates, 2000. ISBN 0-921598-36-X
Websites
Parallel
port Central – http://www.lvr.com/parport.htm
Purpose: To control a DC motor through the
computer.
Background: LEDs can be powered directly from
the parallel port since they require very low voltages (generally in the 3Volt
range). Refer to the Grade 10 Computer Engineering Profile for the exact
activities and schematics to control one LED or eight LEDs. When larger
voltages are required (e.g., a motor) a separate power supply is required. The
power supply and the motor’s requirements should be in the same range (a 6
volt, 500 mA DC motor should have a 6 volt, 500 mA power supply). The motor can
be turned off or on just as the LEDs can be turned off and on in the activities
mentioned above. The difference is that the motors require a switch to control
the separate power supply. Here, a transistor is used to do the switching. A
transistor is an electronic switch that uses a lower voltage (here from the
computer) to control a larger voltage (the separate power supply) that will
actually run the motor. A more thorough explanation of transistors can be found
in several of the reference books listed in this document. The computer should
be isolated from the motor to minimize any possible damage to the computer due
to mistakes in wiring.
Signals
are sent through pin 2 on the parallel port to the base of the transistor. When
the base is set high (a high on D0) the motor circuit is complete and the motor
will turn on. When D0 is set low, the motor will turn off.
Code: This program will turn the motor on and when a
key is pressed, the motor will turn off. This process can be repeated at the
discretion of the user. (This code is written for Turing but can be adapted to
Visual Basic).
var
key: string (1)
var
answer: string
%
The program repeats until n is entered.
loop
%
The motor is turned on
parallelput(1)
put
“Hit any key to turn the motor off.”
getch
(key)
%
The motor is turned off.
parallelput(0)
put
“continue y/n”
getch(answer)
exit
when answer = “n”
end
loop
Enrichment: The program listed above can be
enhanced by developing a graphical user interface (GUI) to control the motor.
Draw three boxes on the screen labelled “ON”, “OFF”, and “EXIT” along with a
circle representing the motor and an arrow that is lit when the motor is on and
outlined when the motor is off. When the “ON” box is clicked, the motor will
turn on and the arrow will be lit. When the “OFF” is clicked, the motor will
turn off and the arrow will be outlined. When “EXIT” is clicked, the motor will
shut off and the program will exit.
Introduction
Visual
Basic uses the out
command to send information to the parallel port. The out command contains two
pieces of information: the port memory address and the data value, both in
hexadecimal. In this lab you will investigate the storage of numbers in
hexadecimal format, relate this to the parallel port, assemble components including
LEDs that can be connected to a parallel port, and write a program that will
control the LEDs.
Part 1 -
Hexadecimal Representation of Numbers
Complete
the worksheet entitled Hexadecimal Representation of Numbers
Part 2 -
Identify the data pins of the parallel port
See
www.doc.ic.ac.uk/~ih/doc/par/ Interfacing to the Parallel Port, and relate this
diagram to the diagram of a byte.
Questions:
1. What pin would be used to send out the signal
1?
2. What pin would be used to send out the signal
2?
3. What pins would be needed to send out the
signal 3?
Part 3 -
Determine the parallel port address of the computer used in the lab
Get this
information from your teacher, a Visual Basic manual or Website
referenced above, or complete the Parallel Port worksheet.
Part 4 -
Assemble the interface
1. Connect wires to pins 2 and 18 of the
parallel port connector.
2. Connect the wire from pin 2 to a resistor.
3. Connect a wire from the resistor to the LED.
4. Connect a wire from the LED to pin 18
(ground) of the parallel connector.
Part 5 -
Write the program
1. Open a new project file in Visual Basic.
2. Add File inpout32.bas to the project.
3. Add a frame and two option boxes.
4. Add three image controls, lighton and
lightoff twice from icons->misc of the standard Visual Basic 4.0
install.

5. Set the visible property of the two images on
the right to false.
|
Private Sub optLEDOff_Click() Out &h378, &h0 imgLED.Picture = imgHideOff.Picture End Sub |
6. Click on the code window for optLEDOff and
enter the following, given that 378 is the parallel port address and 0 is the
data being sent to that port.
|
Private Sub optLEDOn_lick() Out &h378, &h1 imgLED.Picture = imgHideOn.Picture End Sub |
7. Click on the code window for optLEDOn and
enter the following.
8. Run the program. What do you observe?
Assignment
Add
another LED to the project board and wire it up to data pin #2 and ground #19.
If completed correctly the following results should occur.
|
Date
Value |
Program
Statement |
LED
#2 |
LED
#1 |
|
0 |
Out &h378, &h0 |
Off |
Off |
|
1 |
Out &h378, &h1 |
Off |
On |
|
2 |
Out &h378, &h2 |
On |
Off |
|
3 |
Out &h378, &h3 |
On |
On |
The
following is a sample program form.

An
interfacing system consists of a computer, interface, and peripheral. The
computer sends signals to the interface, often through the parallel port. The
signals from parallel port on the computer are generated by the program you
wrote. The interface is composed of electronic components that receive the
signals from the computer and send them to the peripheral to be controlled. In
the simple case where an LED is interfaced to a computer’s parallel port, the
peripheral is the LED. The interface is the wire and resistor that connects the
LED and computer. The computer program sends signals to the interface.
When
an interfacing system does not function correctly, any of the above components
could be a problem. The problem then is to narrow the problem. Some of the
following suggestions should be considered.
·
Is
the interface connected to the computer?
·
Is
the interface connected to the peripheral?
·
If
there is an external power supply (e.g., with motors), is it plugged in?
·
Start
with the simplest program possible to test the hardware.
·
Develop
the project step by step.
·
Do
not write a large program and then test to see if it runs. Start by building
the simplest version of the project first.
·
Learn
how to measure voltage with a multi-meter (different instructions are included
for each model).
·
Learn
how to measure continuity with a multi-meter (different instructions are
included for each model).
·
Check
that there are no internal breaks in the wire (continuity test).
·
Check
that the voltages are correct (voltage test).
·
Check
that the proper signals are leaving the parallel port (use voltage test or
insert LEDs temporarily).
·
Check
that the proper signals are being received by the interface (use voltage test
or insert LEDs temporarily).
·
Check
that the proper signals are being sent by the interface (use voltage test).
·
Check
that the proper signals are being received by the peripheral (use voltage
test).
·
If
the interface is mounted on a breadboard:
·
horizontal
rows (at the top and the bottom of the bread board) are connected. Many
breadboards are built with the horizontal rows split in the middle;
·
vertical
connections are connected;
·
common
(ground) connector for the parallel port and the interface are connected.
·
replace
individual components, one at a time to determine faulty parts.
Summary
Start
with the simplest program and the simplest interface that demonstrates the
smallest part of the system. Build from there one-step at a time, testing each
time.
Time: 180 minutes
Students
research and present findings on careers related to Computer Engineering.
Students also explore the impact of computer technology at home and in the
workplace. Examination of the moral and ethical issues in Computer Engineering
reflect the teachings of the Catholic Church in areas such as social
responsibility, human solidarity, and life and environmental issues.
Strand(s): Impact and
Consequences
Overall
Expectations
ICV.03 -
describe issues relating to the ethical use of computers;
ICV.04 -
identify computer engineering career paths.
Specific
Expectations
IC1.02 -
explain how computer technology affects daily life;
IC1.03 -
describe issues that arise from the growing use of networked systems (e.g.,
complexity, compatibility, security);
IC1.05 -
describe the computer expertise required for engineering and technology
careers;
IC1.06 -
identify post-secondary educational opportunities leading to careers in
engineering and technology, as well as their entry requirements;
IC1.07 -
use a variety of software applications to make class presentations on ethical
issues in computing.
Ontario
Catholic School Graduate Expectations
CGE3b -
create, adapt, and evaluate new ideas in light of the common good;
CGE3f -
examine, evaluate, and apply knowledge of interdependent systems (physical,
political, ethical, socio-economic, and ecological) for the development of a
just and compassionate society;
CGE4f -
apply effective communication, decision-making, problem solving, and time and
resource management skills;
CGE5a -
work effectively as an interdependent team member.
·
basic
Internet/CD/Library/Resource Centre research methods
·
basic
understanding of presentation techniques
·
Organize
career and computer technology reference material (See your student
services/co-op teachers for assistance).
·
Review
standards or guides for successful class presentations, research paper, or
displays.
·
Develop
a progress checklist sheet.
·
Review
classroom behaviour expectations for possible class presentations.
1. Review
the role of Christian values in modern society, including the ethical use of technology
to improve life and develop stewardship of our world.
2. Students
are given the task of selecting a career to research and report on. Teachers
initiate a discussion and development of a list with the class. Students
propose the careers they will research. Teachers schedule group class
presentations in a specified block of time at the end of the course as a
“wrap-up” overview of Computer Engineering. It could also be set up where
individual groups on a weekly basis do class presentations that relate to
particular social, moral, or career aspects of Computer Engineering.
3. Individuals or groups of students research
their selected careers and include the topics of environmental consequences,
technology developments, developments in computer hardware, security, safety,
privacy, ethics, and computer skills required by employers.
4. Students develop presentations, essays,
and/or displays as required for their particular career topic. Presentations
are given to the class.
·
Formative
assessment of student progress.
·
Summative
assessment of presentation that combines teacher and student feedback (Refer to
Appendix 5.5.1 – Impact of Interfacing and Related Careers Rubric).
·
Assist
with group formation to facilitate a peer tutoring or buddy system to promote
an accepting and positive atmosphere and program enhancement or remediation.
·
Provide
written material for students having difficulty processing auditory
information.
·
Review
new vocabulary and definitions prior to and during the lesson.
·
Make
allowances for choice of topic or presentation methods. Individual students
might feel strongly about an issue they would not feel comfortable presenting
to the class but wish to submit as an essay.
·
Conference
with individual students that experience organizational problems with large
amounts of information.
·
Ensure
understanding of tools used to assess/evaluate.
·
Provide
print format and clear direction/expectations for presentation of final
product.
Print
Newspapers
and periodicals
Software
Current
Ministry of Education word-processing and presentation software
Websites
Global
Network of Environment and Technology – http://www.gnet.org
Environment
Canada’s adaptive Computer Technology program – http://www.dinf.org/csun_98_125.htm
Career
and Education – http://www.diversitycareers.com
Online
Ethics Centre for Science and Engineering – http://www.onlineethics.org
Computer
Professionals for Social Responsibility – http://www.cpsr.org/
Privacy
International – http://www.privacyinternational.org/
Electronic
Privacy Information Centre – http://www.epic.org/
Business
Ethics Magazine – http://www.business-ethics.com/
|
Categories |
Level 1 |
Level 2 |
Level 3 |
Level 4 |
|
Knowledge/Understanding |
||||
|
Overall
knowledge of several engineering careers |
-
demonstrates limited knowledge of several engineering careers |
-
demonstrates moderate knowledge of several computer engineering careers |
-
demonstrates considerable knowledge of several computer engineering careers |
-
demonstrates a high degree of understanding of several computer engineering
careers |
|
Understanding
of role of engineer in society |
-
demonstrates limited understanding of role of engineer in society |
-
demonstrates moderate understanding of role of engineer in society |
-
demonstrates considerable understanding of role of engineer in society |
-
demonstrates a high degree of understanding of the role of engineer in
society |
|
Understanding
of presentation format |
-
demonstrates limited understanding of presentation format |
-
demonstrates moderate understanding of presentation format |
-
demonstrates considerable understanding of presentation format |
-
demonstrates a high degree of understanding of presentation format |
|
Thinking/Inquiry |
||||
|
Evaluation
of role of interfacing in engineering |
-
demonstrates limited competence in evaluating role of interfacing in
engineering |
-
demonstrates moderate competence in evaluating role of interfacing in
engineering |
-
demonstrates considerable competence in evaluating role of interfacing in
engineering |
-
demonstrates a high degree of competence in evaluating role of interfacing in
engineering |
|
Analysis
of career opportunities and form possible choices |
-
demonstrates limited analysis of career opportunity choices |
-
demonstrates moderate analysis of career opportunity choices |
-
demonstrates considerable analysis of career opportunity choices |
-
demonstrates a high degree of analysis of career opportunity choices |
|
Communication |
||||
|
Communicating
career observations and conclusions |
-
infrequently communicates career observations and conclusions |
-
sometimes communicates career observations and conclusions |
-
generally communicates career observations and conclusions |
-
effectively communicates career observations and conclusions |
|
Communicating
impact of computers on society |
-
infrequently communicates impact of computers on society |
-
sometimes communicates impact of computers on society |
-
generally communicates impact of computers on society |
-
effectively communicates impact of computers on society |
|
Application |
||||
|
Applying
interfacing to computer engineering careers |
-
infrequently applies interfacing to computer engineering careers |
-
sometimes applies interfacing to computer engineering careers |
-
generally applies interfacing to computer engineering careers |
-
effectively applies interfacing to computer engineering careers |
|
Applying
impact of programming to societal changes |
-
infrequently applies the impact of programming to societal changes |
-
sometimes applies the impact of programming to societal changes |
-
generally applies the impact of programming to societal changes |
-
effectively applies the impact of programming to societal changes |
Note: A student whose achievement is below level 1
(50%) has not met the expectations for this assignment or activity.
Course
Overview | Unit 1 | Course Profiles Main
Menu