36
Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some simple example sensors; Some ways of interfacing between sensor signals and the microcontroller; Some simple example actuators; Some ways of interfacing between the microcontroller and the actuator; The Derbot application of some of its sensors and actuators. Designing Embedded Systems with PIC Microcontrollers: Principles and Applications 2 nd Edition. Tim Wilmshurst Instructors using Designing Embedded Systems with PIC Microcontrollers are welcome to use or change these slides as they see fit. Feedback, to [email protected] , is welcomed. The copyright to all diagrams is held by Microchip Technology, or T.

Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Embed Size (px)

Citation preview

Page 1: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Chapter 8The Human and Physical Interface

The aims of this chapter are to introduce:• Human interfacing needs and some simple means of meeting these;• Some simple example sensors;• Some ways of interfacing between sensor signals and the

microcontroller;• Some simple example actuators;• Some ways of interfacing between the microcontroller and the

actuator;• The Derbot application of some of its sensors and actuators.

Designing Embedded Systemswith PIC Microcontrollers: Principles and Applications

2nd Edition. Tim Wilmshurst

Instructors using Designing Embedded Systems with PIC Microcontrollers are welcome to use or change these slides as they see fit. Feedback, to [email protected], is welcomed. The copyright to all diagrams is held by Microchip Technology, or T. Wilmshurst, unless otherwise stated

Page 2: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The Human Interface

A very high proportion of interaction between humans and machines is by simple digital data, including switches and keypads for input, and alphanumeric or simple graphical displays for output.

Page 3: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The Keypad

A useful step forward from the simple switch is given by the keypad. This allows numeric or alphanumeric information to be entered. It is widely used in photocopiers, burglar alarms, central heating controllers, and so on. The keypad gains a big advantage because all the switches inside it are connected as a matrix, so fewer interconnecting lines are needed, which can be connected to a microcontroller parallel port. Notice that an (n x m) array of keys can be read by (n + m) port bits.

Keypad

1

4

7

2

5

8

0

3

6

9

#*

RowConnections

ColumnConnections

Pull-upResistors

SV

Port bit7654

321

Page 4: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Reading the Keypad

Set Column bits as outputs

Set Row bits as inputs

Set column bits to 0

Read row bits

Set Column bits as inputs

Set Row bits as outputs

Set row bits to 0

Read column bits

Key Value Read

1 0111 011X

2 0111 101X

3 0111 110X

4 1011 011X

5 1011 101X

6 1011 110X

7 1101 011X

8 1101 101X

9 1101 110X

* 1110 011X

0 1110 101X

# 1110 110X

A keypad of this size can be connected to 7 bits of an 8-bit microcontroller parallel port, as shown in previous slide. Any key pressed can be identified using the flow diagram below, with output values shown in the Table.

Page 5: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

;Reads keypad, places pattern into kpad_pat, and resets keypad interfacekpad_rd movf portb,w ;read portb value, this will be row pattern

andlw B'11110000' ;ensure unwanted bits are suppressedmovwf kpad_patbsf status,rp0 ;set row to op, column to ipmovlw B'00001110'movwf trisbbcf status,rp0movlw 00movwf portb ;ensure output values still zeromovf portb,w ;read portb value, this will be column patternandlw B'00001110' ;ensure unwanted bits are suppressediorwf kpad_pat,1 ;OR those results into the pattern

;reset keypad interfacebsf status,rp0 ;set row to ip, column to opmovlw B'11110000'movwf trisbbcf status,rp0clrf portb ;ensure output values still zeroreturn

Reading the Keypad – Example Subroutine

This subroutine applies the previous flow diagram to read a keypad, which is connected to Port B.

Page 6: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Interpreting the Keypad Output

Initialise

Wait

Read keypad pattern

Clear Interrupt FlagReturn from Interrupt

(RETFIE)

Enable InterruptConvert pattern to ASCII

Output to lcd

Is key released?No

Yes

Interrupt

The previous flow diagram is only the starting point for working with keypads. How for example do we detect when the keypad is actually pressed, and how do we interpret the code appearing in the Table?

The flow diagram shown opposite illustrates a practical application of keypad reading, appearing as Program Example 8.1. It is too long to show here. The program is used to illustrate use of both keypad and lcd.

To detect keypad action, it uses the Interrupt on Change facility, available on the higher four bits of Port B.

The Interrupt Service Routine does four main things. It reads a pattern from the keypad, converts this to ASCII code, sends the code to the liquid crystal display, and waits for the key to be released, before leaving the ISR.

See how the keypad is accessed in Program

Example 8.1.

Page 7: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The 7-Segment Display This format is very versatile, and widely-used, particularly with leds. Like the keypad, there is a risk of excessive interconnections. Therefore the leds are connected in either “common cathode”, or “common anode” format. In the standard pattern each segment is balled with a letter, from a to g. Usually a decimal point (DP) is included.

common anode

common cathode

(Reproduced with permission of Kingbright Elec. co. ltd)

Page 8: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Making Multi-Digit Displays

Detail of Display Circuit Diagram

By making a common cathode or common anode connection, the number of connections to a single digit is reduced. But a digit on its own is rarely used, and multiple digits will still require many connections. Therefore a second, important technique is introduced - digit multiplexing. All the segments of one type are connected together, while the common anode or cathode of each digit is independently driven.

Segment Drives

Digit Drives

dpe d c

g f a ba/c

a/c

ZVN4206A

Digit 1 Digit 2 Digit 4Digit 3

dpe d c

g f a ba/c

a/c dpe d c

g f a ba/c

a/c dpe d c

g f a ba/c

a/c

ZVN4206A ZVN4206A ZVN4206A

Page 9: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Driving the Multi-Digit Display

Segment

DigitDrives

Drives

Digit 1

Digit 2

Digit 3

Digit 4

segment pattern

for Digit 1

segment pattern

for Digit 2

segment pattern

for Digit 3

segment pattern

for Digit 4

segment pattern

for Digit 4

Timing Diagram for Driving the Digits

The way this display is driven is shown in the timing diagram below. The digits are activated continuously in turn. If this is done at the right speed, the eye is tricked into thinking that all digits are being continuously lit. The diagram shows the segments for Digit 4 being set, and the Digit 4 common cathode being set to 1. Digit 4 is therefore switched on, while all other digits are off. This is held for a period of time (around 5-20ms is generally appropriate), and then Digit 2 is illuminated in a similar way. Each digit is lit in turn, and the cycle recommences.

See how the display is controlled in

Program Example 8.2.

Page 10: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Driving the Multi-Digit Display – a Practical Example

Digit 1active

Digit 2active

Digit 3active

Digit 4active

5ms/div.

seg. a

seg. bseg. cseg. d

seg. e

seg. fseg. g

d.p.

Digit 1

Digit 2

Digit 3

Digit 4

This timing diagram, taken on an Agilent oscilloscope, shows the logic state of all connections to a 4-digit display. The word “HELP” is being displayed. Work out which digit displays which letter.

Page 11: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The Liquid Crystal Display

The Liquid Crystal Display (lcd) has been one of the enabling technologies of the current electronic revolution. It is an essential part of every mobile phone, laptop, and personal organiser. Liquid crystal is an organic compound which responds to an applied electric field by changing the alignment of its molecules, and hence the light polarisation which it introduces. • A small quantity of liquid crystal is contained between two parallel glass plates. An electric field can be applied if transparent electrodes are located on the glass surface. • External polarising light filters are used. In conjunction with these, light is either blocked, or transmitted by the display cell. • LCDs do not emit light, but they can reflect incident light, or transmit or block backlight.

Liquid Crystal

Transparent Conductive Coating

Glass

Contacts

ElectricalPolarising Filter

LCD Structure (simplified)

Page 12: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Practical LCDs

A huge range of lcds has been developed, including those based on 7-segment digits or dot matrix formats, as well as a variety of graphical forms. Many general-purpose displays are available commercially, while customised displays are made for large-volume products. The Derbot hand controller uses an example of a very popular and useful general-purpose format, as shown here. It has two lines, of 8 digits each, where each digit is a liquid crystal dot matrix. Larger displays in this format are common, with more digits, and more lines.

Driving lcds directly is not entirely simple. This need not concern us too much as most displays, like this one, contain their own drive electronics, designed to be interfaced to a microcontroller. The need is then to understand how to interface to the drive electronics. This one has its own on-board microcontroller, specially designed to drive LCDs, based on the Hitachi HD44780.

Powertip PC0802-A

RSE

DB0DB1

DB3DB2

DB4DB5DB6DB7

R/W

VDD

VSS

Vo20k

2x8 DigitLCD Display

Powertip PC 0802-A

+5V

0V

Page 13: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The HD44780 LCD Driver, and Derivatives

The HD44780 has a simple interface that can be connected to a microcontroller. This has become something of an informal standard. Many manufacturers of displays integrated it into their products. A generation of derivatives now exists, which have replaced the original Hitachi device, but retain most of its features. These include the S6A009 and KS0066U devices made by Samsung.

• Data is transferred on a 4- or 8-bit data bus, determined by the user. Using the 4-bit mode allows the whole interface to be contained within just 7 bits, but is a little slower.

• Bit 7 of the data bus doubles as a “busy flag”, indicating whether the device is ready to accept new data.

• Data may be instruction or character information.

• Control is exercised by three control lines:

• Register Select (RS), which determines whether an instruction or character data is being transferred,

• Read/|Write (R/|W), which determines data direction,

• Enable (E), which provides a clock function to synchronise data transfer.

• There is a simple instruction set, which allows control of operating characteristics.

• The user can access two registers, depending on the state of the RS line:

• an instruction register, used to transfer instructions (RS = 0),

• a data register, used to transfer display data, for example character codes (RS = 1).

• Internal resources include 80 bytes of display RAM, and a character generator ROM.

• On power-up, the HD44780 must undergo a very specific initialisation process. It is important to get this absolutely right, or the display may just sit inactive.

Page 14: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

RS

R/W

E

DB7

DB6-0

InstructionWrite

Busy Flagand Address Counter read

Busy BusyNot

Busy

CharacterWrite

InstructionCode

Address

Counter Counter Counter

Address Address

Code

Character

The HD44780 Timing Diagram

HD44780 Timing Diagram, 8-bit Interface

The bus operates in 8-bit mode in this example. • Every data transfer is enabled by a pulse on the E line. • With RS set low, the data on the data bus is interpreted as an instruction. • To check for completion, R/|W is taken high, - on the next cycle of E the lcd controller outputs a word with the busy flag as msb. This is checked repeatedly until the busy flag is cleared. • When it goes low, RS in this example is taken high, R/|W is taken low, and the next data transfer is therefore a character code.

Page 15: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

An LCD Design

Example

The Derbot Hand Controller, in its lcd version, uses a Powertip PC0802-A display. It is controlled by the S6A0069 lcd driver microcontroller (which has the features of the HD44780) used in 8-bit interface mode. The keypad is connected to Port B, and the LCD to Port A and some bits of Port C. (The use of the I2C bus for external connection complicates the allocation of pins for this interface).

See how the lcd is controlled in

Program Example 8.3.

Page 16: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Liquid Crystal Displays such as the one just described are enormously useful in the world of small to medium embedded systems. They are low power, and comparatively flexible in their use. On the down side, interfacing to them can be tiresome, with not insignificant blocks of code required just to transfer simple messages. Because their interface is slow, they can become a limiting factor in high-speed systems.

A Brief LCD Evaluation

It is perfectly possible to write original code to drive a HD44780 derivative. However it can be time-consuming to get the code right. There is plenty of example code available (e.g. in Program Example 8.3), which can readily be used. Be sure that it is correct for the lcd that you are using however, as there are some differences between them.

A Practical Point

Page 17: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

In our study of embedded systems, we need to know what transducers are available, what they can do, and how we can interface to them. In this lecture some interfacing techniques essential to embedded systems are introduced.

The transducers used in the Derbot AGV are also introduced. While this might seem an arbitrary choice, they are as good a selection as any - it would be impossible to try to undertake a survey of all transducers.

Working with Sensors & Actuators

Light Dependent Resistor

DC Motor Ultrasonic sensor

Microswitch “Servo”

Page 18: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

A light dependent resistor (LDR) is made from a piece of exposed semiconductor material. When light falls on it, it creates hole-electron pairs in the material, which improve the conductivity. When light is removed, the hole-electron pairs recombine, and conductivity falls. The overall effect is that as illumination increases, the LDR resistance falls.

Light Dependent Resistors

5V

0V

Vo

RLDR

10k

The NORP12 LDR Connected in a Potential Divider, with Indicative Output Values

Illumination (lux)

RLDR () Vo

Dark > 1.0 M > 4.95

10 9k 2.37

1,000 400 0.19

Page 19: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

A reflective opto-sensor has an infrared led and phototransistor mounted side by side in a plastic package. The package material allows infrared light to pass, but filters ambient visible light. When a reflective surface is placed in front of the sensor, some of the emitted light is reflected back to the phototransistor, which then conducts. If the sensor is connected in the circuit shown, then output Vo is at logic 1 when no reflection occurs, and at logic 0 if a reflective surface is present. The distance from sensor to reflective surface is critical in many such sensors, with preferred distances around 3mm being common.

Optical Object Sensing

plastic

housing

anode cathode collector emitter

REFLECTIVE SURFACE

22k

Vo

100R

5V

The Reflective Optical Sensor Sensor Used as a Shaft Encoder on

the Derbot

Page 20: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Ultrasound is widely used for sensing and measurement, from simple distance measurement, to complex medical imaging. The Derbot uses an ultrasonic reflective sensor to detect objects around it. The sensor consists of a transmitter and receiver. The ultrasound source is pulsed, and the time taken for the echo to return is measured; from this a distance can be calculated. The timing diagram is shown. A logic pulse is input to the module trigger input. This causes an 8-cycle ultrasonic burst to be generated. The echo output of the module then goes high, and remains high until an echo is detected, at which point it goes low. If the duration of the pulse is measured, then the distance away of the object that caused the reflection can be calculated.

Ultrasonic Object Sensor

Simplified Timing Diagram for SRF04 Ultrasonic Ranger

TriggerInput

UltrasoundBurst fromModule

Echo Pulse

Echo Received

See Program Example 9.7 for

an example using this sensor

Page 21: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

If a microcontroller is to receive logic signals, then it is essential that those signals are at voltage levels which are recognised by it as being either logic 0 or logic 1. These voltage levels are usually defined by logic family, for example TTL (Transistor Transistor Logic) or CMOS (Complementary Metal Oxide Semiconducter). When one device is connected to another, and each is supplied by the same voltage and is of the same logic family, then it is safe to assume that logic levels will be reliably transferred. However if signals are generated from a non-logic source, e.g. a sensor, or if they have been received over a long communication link, or have been subject to interference, then there may be problems.

More on Digital Input

Undefined Logic Level

0.8V

2.0V

0V

5.0V5.3V

-0.3V

"Absolute Maximum" rating

Logic 1

Logic 0

"Absolute Maximum" rating

Device DamageIrreversible

Device DamageIrreversible

(supply voltage)

16F873A Port Bit Input Voltage Levels, 5V Supply

Page 22: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

It is up to the designer to ensure that the input voltage is only ever steady state in one of the recognised logic levels, i.e. one of the shaded zones in the previous slide. It can pass quickly through the intermediate undefined zone, but must not linger there. It must never exceed the maximum ratings.

Forms of Signal Corruption

0V1V2V3V

5V4V

6V

a)

0V1V2V3V

5V4V

6V

c)

0V1V2V3V

5V4V

6V

b)

0V1V2V3V

5V4V

6V

d)

DC offset in signal

Different Forms of Signal Corruption

Spikes in signal, potentially harmful to device input Spikes in signal

Excessively slow edges

Page 23: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Input Protection

VS

R

Ground 2

V VS1 S2

Ground 1

Output

Input

The Opto-Isolator

Current Limiting Resistor (relying on internal Protection Diodes)Input Protection Diodes

Page 24: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The Schmitt Trigger

Input/Output Characteristic

Schmitt Trigger Symbol

Pin RA4 of the 16F873A. Schmitt trigger has hysteresis of around 0.1V. Note that all inputs on Port C are Schmitt trigger.

Vi Vo

Vi

Vo

positive-goingthreshold

negative-goingthreshold

Page 25: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

R

C

Schmitt Trigger plus Low Pass Filter

Schmitt Trigger withLow Pass Filter

Actual Signal from the Derbot Reflective Opto-Sensor. This is “cleaned up” using above circuit.

Page 26: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Vo

VS

RV

S

t

Vo

R 1

R 2

C

VS

Vo

Vo

VS

Vo

VS

The Simple Switch Interface

Bistable

Switch Bounce

Vo on Switch Closure

Schmitt Trigger Buffer

Debounce Achieved Through Hardware

Page 27: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

VS

t

Vo

InputPolling

t

t

PerceivedInput

0

1

Polling Misses Switch Bounce

VS

t

Vo

InputPolling

t

t

PerceivedInput

0

1

t0

1

OR

Polling Coincides with Switch Bounce

Switch Debounce Achieved Through

Polling

Page 28: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

The “Servo” output is a shaft that can take an angular position over a range of around 180o. The input to the Servo is a pulse stream, generally of 50Hz (i.e. period of 20 ms). The width of the input pulse determines the angular position of the output shaft. In the example here, a pulse width of 1.25ms leads to an output shaft position of 0o, 1.5ms to an output shaft position of 90o, and 1.75ms to an output shaft position of 180o (this is an example of Pulse Width Modulation, which we meet later).

Angular Positioning: The “Servo”

1.25ms0 degrees

90 degrees

180 degrees

1.5ms

1.75ms0

20ms

Servo Input and Output Characteristics

Page 29: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Switching Real Loads

When it comes to controlling real loads, the microcontroller on its own only has the very limited output capability of its port pins (as shown alongside), just enough to drive an led or some other small load. In almost every case an interface circuit will be required.

Page 30: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Transistor Switching of Resistive DC Loads

Bipolar Transistor

In many embedded systems we want to be able to switch DC loads electronically. The standard circuits on this slide and the next represent simple ways of switching small resistive loads from a logic circuit.

V S VS

ILIL

IB

IB

> IL

VG

VG > VGS(th)

RLRL

RB

RBI

=Vi - 0.6

B

VOH

base current controls load current

gate voltage controls load current

MOSFET

Page 31: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

path of decaying current when transistor

is switched off.

L

R

I

V

D

V i

S1

p

V

0V

i

I

On-Off Switching of Inductive Loads

Inductors, including motors, relays, solenoids etc, store energy when current is flowing in them, and this energy must be returned to the circuit in a controlled manner when the current is switched off. Otherwise arcing will occur. For DC switching this is normally done with a “free-wheeling” diode. “freewheeling” diode

Page 32: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

ZVN4206ZVN4206

piezosounder OptoOpto

Left Right

5V

5k6 5k691R

Port B bit 2Port B bit 1

Kingstate electronicsKPE-204A

0V

OptekOPB608A

Section of Derbot Circuit Diagram – Switching of Opto Sensors and Piezo

Sounder

Example Switching Circuit

Characteristic ZVN4206A

Maximum Drain-Source Voltage VDS 60V

Maximum Gate-Source Threshold VGS(th) 3V

Maximum Drain-Source Resistance when ‘On’ RDS(on)

1.5

Maximum Continuous Drain current ID 600mA

Maximum Power Dissipation 0.7W

Input Capacitance 100pF

ZVN4206A Characteristics

Page 33: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

VS

Input X Input Y

Load

"high side"

"low side"

A B

Reversible Switching: the H-Bridge

Current Path, X high, Y low

Current Path, Y high, X low

Page 34: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

Vos

Vos

Vos

Vos

IN 1

IN 2

IN 3

IN 4

Enable 1 Enable 2

Out 1

Out 2

Out 3

Out 4

V VLS

0V

8

2

1

7

4,5,12,136 14

3 11

10

9

15

16

1 3

2 4

OS

Operating Conditions - Highlights600mA Output Current per channel 1.2A Peak Output Current (non repetitive) per channelOver temperature protection High noise immunity (Logic 0 input voltage to 1.5V)

The L293D Dual H-Bridge

Page 35: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

LeftMotor

RightMotor

1/6 'HC14

L293D

En1In1Out10V0VOut2In2VOS

VLSIn3

Out30V0V

Out4In4En2

+5V

9

8

10

11

1/6 'HC14

Port C bit 1

Port C bit 2

+9V

Port A bit 5 Port A bit 2

The L293D Applied in the Derbot Motor Drive Circuit

Vos

Vos

IN 1

IN 2

Enable 1

Out 1

Out 2

Vos

8

2

1

7

6

3

1

2

Motor

CCP2 (Port C, bit 1) Port A, bit 5

1/2 L293D

V

16

LS

IL

Page 36: Chapter 8 The Human and Physical Interface The aims of this chapter are to introduce: Human interfacing needs and some simple means of meeting these; Some

LeftMotor

RightMotor

DERBOT TJW Rev.10.2.06

100n4MHz

Mode switch

24k

1/6 'HC14

L293D

En1In1Out10V0VOut2In2VOS

VLSIn3

Out30V0V

Out4In4En2

Power in

6xAA Power On Switch

100u, 10V

Reset

24k

LP2950

24k

uswitch 1

24k

ZVN4206

piezosounder

(9V)

+5V

2x30p

9

8

10

11

Connector 1uF tant.

R3R4

LeftRight

R1

R13

12

56 (nc)

Diagnostic LEDs820R

820R

Right

LeftR11

R12

ICD2Conn.

uswitch 2

10k

10k

Alk.

16F873A

MCLRRA0RA1RA2RA3RA4RA5VssOsc1Osc2RC0RC1RC2RC3 RC4

RC5RC6RC7

RB7RB6RB5RB4RB3RB2RB1RB0VddVss

C4 C5

C3

TR1

C2C1

1/6 'HC14

74HC14

Derbot Build Stage 2

See how this Derbot build is applied in Program Example

8.4.

End of Lecture Note