introductory interfacing electronics n.
Skip this Video
Loading SlideShow in 5 Seconds..
Introductory Interfacing & Electronics PowerPoint Presentation
Download Presentation
Introductory Interfacing & Electronics

Loading in 2 Seconds...

play fullscreen
1 / 53

Introductory Interfacing & Electronics - PowerPoint PPT Presentation

  • Uploaded on

Introductory Interfacing & Electronics. Peter Beens Presented at Durham College November, 2004. Overview. This presentation covers a basic introduction to interfacing with the parallel port and just enough electronics to keep you from damaging your computer.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

Introductory Interfacing & Electronics

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introductory interfacing electronics

Introductory Interfacing & Electronics

Peter Beens

Presented at Durham College

November, 2004

  • This presentation covers a basic introduction to interfacing with the parallel port and just enough electronics to keep you from damaging your computer.
interfacing overview
Interfacing Overview




  • Wires
  • ICs
  • Resistors
  • Capacitors
  • Transistors
  • Connectors
  • LEDs
  • Motors
  • Lights
  • Robots
  • Joystick
  • Music Box
what ports can we interface
What Ports Can We Interface?
  • Parallel Port (AKA Printer Port)
  • Serial Port (AKA RS232)
  • Keyboard Port
  • USB??? (Hopefully soon…)

We will concentrate on the Parallel Port

identifying the parallel port
Identifying the Parallel Port
  • It’s the female connector with 25 pins
  • “DB25”

Can be on a card

three main invisible electrical properties
Three Main Invisible Electrical Properties
  • Voltage, V, Volts
    • Provides the “push”
  • Current, I, Amperes (Amps)
    • Flow of Electrons
    • Amount of Current is dependent on Voltage and Resistance
  • Resistance, R, Ohms (S)
    • Limits the amount of current
safe current voltage levels
Safe Current & Voltage Levels
  • Voltage: 30 V
    • Voltages inside a computer do not exceed 12 V, except at the power supply and power switch on older computers, which are at 120 V.Be careful in these areas!
  • Current: 5 mA (0.005 Amperes)
  • Is the flow of electrons
  • Direction depends on convention
ohm s law
Ohm’s Law

“Current (I) is proportional to Voltage (V) and inversely proportional to Resistance (R)”

ohm s law power wheel
Ohm’s Law & Power Wheel

Reproduced by permission of Tony van Roon, 2002

kirchhoff s laws
Kirchhoff’s Laws
  • Kirchhoff’s Voltage Law
    • “The sum of the voltage drops equals the applied voltage”, or…
    • “The sum of the voltage drops around a closed loop equals zero”
    • Used in series circuits
  • Kirchhoff’s Current Law
    • “The current entering a junction must equal the current leaving the junction”
    • Use in parallel circuits.
light emitting diodes leds
Light Emitting Diodes (LEDs)
  • A type of diode designed toemit light
  • Can be visible or IR
  • 2 V voltage drop
  • Typically draws 20 mA (0.020 A)
  • Schematic Symbol…
  • Can be rated by…
    • Resistance (Ohms, S)
    • Tolerance (% of nominal value)
    • Power Rating (Watts)
  • Schematic Symbol…
resistor colour code
Resistor Colour Code

Reproduced by permission of Tony van Roon, 2002

resistor colour code example
Resistor Colour Code Example
  • 1st band: orange = 3
  • 2nd band: orange = 3
  • 3rd band: red = 2 (i.e. 102)
  • 4th band: gold = 5%

33 x 102

= 3300 S

= 3.3 kS

series circuits
Series Circuits
  • One current path, therefore the current is the same everywhere
  • Total resistance is the sum of the individual resistances
parallel circuits
Parallel Circuits
  • More than one current path
  • Total current is the sum of the individual currents
parallel port specifications
Parallel Port Specifications
  • Output Voltage
    • 0V for “low”
    • 5V for “high”
    • TTL (Transistor-Transistor Logic)
  • Output Current Limitation
    • 10-15 mA (careful!)
parallel port pinout
Parallel Port Pinout

Graphic from

understanding the led circuit
Understanding the LED Circuit
  • The parallel port output is 5V
  • A standard red LED needs ~20 mA and drops about 2 V
  • A resistor is needed to “drop” the excess voltage
doing the math
Doing the Math

From Kirchhoff’s Voltage Law

From Ohm’s Law

Currents equal in a series cct

motor control



Motor Control

(A stepper motor would require more outputs)

turing preparing for interfacing
Turing: Preparing for Interfacing
  • Turing is already prepared for interfacing with the parallel port
  • No preparation necessary!
turing turning on the led
Turing: Turning On the LED
  • Parallelput(value)
  • Parallelput(1) turns on the 1 bit (D0)
  • Parallelput(255) turns on all bits (D0-D7)
turing flashing the led
Turing: Flashing the LED


parallelput (1)

delay (250)

parallelput (0)

delay (250)

end loop

turing led walking
Turing: LED Walking


% loops up

for i : 0 .. 7

parallelput (2 ** i)

delay (500)

end for

% loops down

for decreasing i : 6 .. 1

parallelput (2 ** i)

delay (500)

end for

end loop

java preparing for interfacing
Java: Preparing for Interfacing
  • Download
  • Extract the parport folder to your classes folder
  • Copy parport.dll to you bin folder
  • import parport.ParallelPort;
  • ParallelPort lpt1 = new ParallelPort (0x378);
java output
Java: Output

ParallelPort lpt1 = new ParallelPort(0x378);

int byteVal = 255;


System.out.println("Output to port: " + byteVal);

java input
Java: Input

ParallelPort portIn = newParallelPort (0x378);

int in;

in = ();

System.out.println (in + " is currently being input.");

java delay method
Java Delay Method

private static void delay (int mS)



Thread.sleep (mS);


catch (Exception e){




delphi preparing for interfacing
Delphi: Preparing for Interfacing
  • Download io.dll from
  • Copy into project folder
delphi output
Delphi: Output

procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

procedure TForm1.Button1Click(Sender: TObject);




delphi input
Delphi: Input

function PortIn(Port:Word):Byte; stdcall; external 'io.dll';

procedure TForm1.Button3Click(Sender:TObject);


InValue : Byte;


InValue := PortIn(889);

label1.Caption := IntToStr(InValue);


delphi delay procedure
Delphi Delay Procedure

procedure xSleep(milliseconds: LongInt); variTemp : Longint;


iTemp:= GetTickCount + milliseconds;

while GetTickCount < iTemp



assembler output
Assembler: Output

MOV DX,0378H



Where n is the value you want to output.

web resources
Web Resources
textbook references
Textbook References
  • Computer Engineering: An Activity-Based Approach (Holt)
  • Networks, Interfaces and Integrated Circuits (Holt)
q why can t programmers tell the difference between christmas and halloween
Q: Why can't programmers tell the difference between Christmas and Halloween?

A: Because DEC25 = OCT31

contact information
Contact Information
  • Pete BeensWestlane Secondary SchoolNiagara Falls, ONL2H1T5905.356.2401
  • Web:
  • Email: