I went out and got myself an L298N h-bridge controller. My plan is to get the hang of controlling a motor using the L298 using PWM before getting the motors I would need. As the "rat motor" I am using the motor; pictures, of which I have posted above to test out the pwm.
I know the 16f877a has 2 PWM modules, but I thought for now, just to get the hang of it, to code the PWM in software. So this is what I did. I read up on PWM theory. Armed with that knowledge, I coded a PWM routine with period cycle of 1 second. Since this was my first tryst with pwm, I set it at 50% duty cycle. I expected the motor to run for 500ms and do nothing for another 500ms.
But when I loaded the program and everything the motor did not move at all. But I heard some ticking noise coming from the motor. When I touched it, I felt vibrations at half a second pulses. And then when I pressed hard on the terminals of the motor that lead to the power supply, it started rotating at half a second pulses. When I removed my hand again, the motor stopped rotating but the vibrations were still there. Whenever I had my fingers on the terminals of the motor, it would conform to the pwm. I know its not a case of loose connection or anything. I don't know whats happening.
Anyone know what it is?
And could someone guide my to a tutorial or some article dealing with how to use the PWM module in 16f877a. I read the datasheet but it wasn't exactly clear.