DC motor control with PIC18F4550 and L293D – Proteus simulation

DC motor interfacing with PIC18F4550 and L293D
This topic shows how to control DC motor rotation direction and speed using PIC18F4550 microcontroller and L293D motor driver chip.
A pot is used to control motor speed and two pushbuttons are used to control rotation direction.
Related topics:

The following topic shows how to control speed and direct of a DC motor using PIC18F4550 and H-bridge circuit:
DC motor speed and direction control with PIC18F4550 microcontroller

 DC motor control with PIC18F4550 and L293D circuit:
PIC18F4550 L293D dc motor control circuit
In the circuit there are 3 push buttons, 2 for selecting the direction and the other one for stopping the motor. The 2 LEDs are used to indicate the motor rotation direction, if LED1 is ON that means direction 1 has been chosen and the same thing for LED 2. If both LEDs are OFF that means the motor has been stopped.
The nominal voltage of the motor is 12V as well as L293D VS input voltage. The L293D VS voltage should be the same as the DC motor voltage and L293D VSS voltage is +5V.
A pot (pin AN0) is used to change the motor speed.
The microcontroller PIC18F4550 reads analog data from channel 0 and use the digital value to set the PWM duty cycle. If direction 1 button is pressed the microcontroller starts PWM1 (RC2 pin) and stops PWM2 (RC1 pin) and if direction 2 button is pressed the microcontroller stops PWM1 (RC2 pin) and starts PWM2 (RC1 pin), when the stop button is pressed the microcontroller stops PWM1 and PWM2 signals and the motor will stop.
The PWM (PWM1 & 2) frequency is 488Hz.

DC motor control with PIC18F4550 and L293D CCS PIC C code:
PIC18F4550 Timer2 is configured to generate a PWM frequency of 488Hz and the microcontroller runs with 8MHz internal oscillator.
The microcontroller PIC18F4550 reads RA0 analog value and stores the digital value on variable (i), this variable is used to set duty cycle of the active PWM (PWM1 or PWM2).

DC motor control with PIC18F4550 and L293D Proteus simulation video:
The following video shows the simulation using Proteus.

Proteus simulation file download:
You can download Proteus simulation file from the following link.
DOWNLOAD


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

3 thoughts on “DC motor control with PIC18F4550 and L293D – Proteus simulation”

  1. Good day all,
    Would it be possible to have a copy of the HEX file for the above project as I’m starting out in controller programming and it would be useful for diagnosing the mistakes that I keep making, which is many.
    With thanks

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top