Cantafford
Member
Hello again,
I have finished a project in which I control a DC motor using a PIC18f2550 and a L293D integrated H bridge.
The L293D truth table is this:
This is my schematic:
As I'm sure it's obvious the project is supposed to work this way:
-I press one of the buttons to select direction: CW or CW(RB0 or RB1).
-then I select a speed from Rb2-Rb5 in ratios of 1/4(25%, 50%, 75%, 100%). The CCP1 of the PIC is connected to the enable pin of the L293D to send the PWM signal.
The program is supposed to let me select a direction then the speed in real time. And it does. With a little problem which I can't figure out. When I try to deccelerate from 100% speed(aka when I try to lower the duty cycle from 100% to any of 25%, 50% or 75%) for some odd reason my enable pin is driven to 0 so my motor stops. From there I can accelerate back to 100% but I cannot decelerate again without the motor stopping.
when I try to deccelerate(select a different speed other than 4) it goes to that specific while of the selected speed but the enable pin(RC2 is driven to 0) so the access to the L293D bridge is stopped. Maybe it is a coding issue(altough it does return to the while of the selected speed) or maybe it's something related to the falling edge of the signal. Beats me. Please help me correct this issue.
P.S.: Yes I know I've made a lot of threads today. This is the last one, I promise, sorry for the spam.
I have finished a project in which I control a DC motor using a PIC18f2550 and a L293D integrated H bridge.
The L293D truth table is this:

This is my schematic:

As I'm sure it's obvious the project is supposed to work this way:
-I press one of the buttons to select direction: CW or CW(RB0 or RB1).
-then I select a speed from Rb2-Rb5 in ratios of 1/4(25%, 50%, 75%, 100%). The CCP1 of the PIC is connected to the enable pin of the L293D to send the PWM signal.
The program is supposed to let me select a direction then the speed in real time. And it does. With a little problem which I can't figure out. When I try to deccelerate from 100% speed(aka when I try to lower the duty cycle from 100% to any of 25%, 50% or 75%) for some odd reason my enable pin is driven to 0 so my motor stops. From there I can accelerate back to 100% but I cannot decelerate again without the motor stopping.
when I try to deccelerate(select a different speed other than 4) it goes to that specific while of the selected speed but the enable pin(RC2 is driven to 0) so the access to the L293D bridge is stopped. Maybe it is a coding issue(altough it does return to the while of the selected speed) or maybe it's something related to the falling edge of the signal. Beats me. Please help me correct this issue.
P.S.: Yes I know I've made a lot of threads today. This is the last one, I promise, sorry for the spam.
Last edited: