
Microcontroller devices are capable of supplying small amounts of current to drive small low power circuitry but are unable to provide the power to drive high voltage or high current devices. This document deals with taking signals from the microcontroller and using them to drive up to two D.C. motors. The motor’s speed will be controlled by a PWM output. The motor’s direction will be controlled by a standard digital output pin. The device used to boost the power going to the motor is a L293 motor driver chip which is available from Rapid for £3.19, order code 82-0192.
Example of the L293 connected to the microcontroller and the output terminals with optional Bi-colour LEDs

The digital output pin controls the direction of each individual motor. When the output is high the motor will be powered when the PWM signal is low. Alternatively when the direction output is low the motor will be powered when the PWM signal is high.
Example of how the direction and PWM output pins effect the motor voltage

The example Flowcode file uses a PIC16F877A microcontroller with digital outputs RA0 and RA1 for the direction controls, RC1 and RC2 for PWM controls. Following are some example settings and the predicted motor output power.
Example of how to modify the direction and speed of a motor
