hi,
I'm a beginner in this amazing world of PICs and I have encountered 2 problems in controlling a dc motor direction...
1. I used this H-bridge to control my motor (see attachments) and works fine while adding a voltmeter across the output but when load it with any load e.g my 9v motor the voltage decreases to a value of 0.01v and couldn't drive my motor.
2. I wrote this program that reads a potentiometer value ,if this value is greater than 12kohms turns the motor CW, less than 12k ohms turns the motor CCW:
the program worked but instead of comparing the value to 12 k ohms it performs this operation at 1.2k ohms (I have checked my scale!)device=16f84a
dim R_Value as byte
trisb=%00000001
start:
portb=0
r_value=pot portb.0,153
if r_value > 65 then goto rotate_lower 'Making motor rotate CW
if r_value < 59 then goto rotate_higher 'Making motor rotate CCW
Rotate_Lower:
portb.1=1
delayms 250
goto start
Rotate_Higher:
portb.2=1
delayms 250
goto start
any help will be appreciated, thank you![]()
Bookmarks