Cantafford
Member
Hello everybody and happy new year!
I'm trying to make a simple project in which I control the direction of a DC motor with a L293D driver and it's speed in ratios of 25%, 50%, 75% and 100% of full speed. Therefore I suppose I need to use 2 PWM's from the PIC(CCP module). The PIC I'm using is PIC18F2620. Datasheet here: https://ww1.microchip.com/downloads/en/DeviceDoc/39626e.pdf
I have chosen a frequency of 1.5 Khz for the PWM signal.
This is my schematic:
The truth table for the L293D motor driver is this:
I've never used 2 CCPs before but from what I understood from the datasheet of my PIC, to use one PWM module I have to make it as output. Not sure if this is the right way to do it .So my logic was, configure the duty cycle and period and then make the CCP module that I want to use as output. For example: If I want CCW direction, make CCP1 pin(RC2) as output and hold CCP2 pin(RC1) as input. Sorry if the explanation is ambiguous.
I'm trying to make a simple project in which I control the direction of a DC motor with a L293D driver and it's speed in ratios of 25%, 50%, 75% and 100% of full speed. Therefore I suppose I need to use 2 PWM's from the PIC(CCP module). The PIC I'm using is PIC18F2620. Datasheet here: https://ww1.microchip.com/downloads/en/DeviceDoc/39626e.pdf
I have chosen a frequency of 1.5 Khz for the PWM signal.
This is my schematic:

The truth table for the L293D motor driver is this:

I've never used 2 CCPs before but from what I understood from the datasheet of my PIC, to use one PWM module I have to make it as output. Not sure if this is the right way to do it .So my logic was, configure the duty cycle and period and then make the CCP module that I want to use as output. For example: If I want CCW direction, make CCP1 pin(RC2) as output and hold CCP2 pin(RC1) as input. Sorry if the explanation is ambiguous.
Last edited: