I am confused while trying to understand the code you've provided in L298 DC Motor Control: Software.
L298's operating instructions are as follows:
Code: Select all
| Inputs | Function
------------------------------------|--------------------------
Ven = H | C = H ; D = L | Forward
| C = L ; D = H | Reverse
| C = D | Fast Motor Stop
------------------------------------|--------------------------
Ven = L | C = X ; D = X | Free Running Motor Stop
As I understood, in your code,
Code: Select all
Delay100TCYx(speed_pos);
PORTBbits.RB1 = 1;-------------------\
> Forward mode
PORTBbits.RB2 = 0;-------------------/
Delay100TCYx(speed_neg);
PORTBbits.RB1 = 0;-------------------\
> Reverse mode
PORTBbits.RB2 = 1;-------------------/
What I understood was, this code will make the motor to move forward and reverse within 0.5 seconds.
Please let me know where my understanding of your code fails.
Regards,
/Lakmal