
Originally Posted by
shaiqbashir
Thanks a lot for all ur help!
@skimask:
Thanks for that idea ! Well! surely i have written up my own code as well, that dint work so i have asked on this forum to provide me some help. I do admit my mistake that i dint provide my own code here: Well! This is what i have tried to do:
I have used PIC16F84A here. I havegot two motors. So two h-bridges surely.Now in each H-bridge, there are 4 inputs to be controlled logically:
1) Left P-channel MOS
2) Left N-channel MOS
3) Right P-channel MOS
4) Right N-channel MOS
now u see, if i take one H-bridge into my consideration. I can ON the pin containing Left P-channel MOS using HIGH command. then i can OFF the pins containing Right P-channel and Left N-CHannel MOSFETs using LOW command. When i apply PWM command on the port containg Right N-channel MOS, the H-bridge works and the motor rotates in one direction. So i say that my H-bridge is controlled by PWM command now.
Now comes the tricky part:
Now i have to drive the second H-bridge simultaenously as well. In PIC16F84A, there is only one PWM present. So what i decided to do is simply this that i connect run the second H-bridge totally by HIGH and LOW commands. I dint give any PWM command in the second H-bridge at all. Like I ON the Left P-channel and Right N-channel using HIGH command. I OFF the Right P-channel and LEft N-channel using LOW command. The motor runs in one direction as well.
What i had in my mind at that time, that i would first see that which of my motor is a faster one, Then i would use PWM command with the faster motor and will control the slower motor with HIGHs and LOWs only. So that i can reduce the speed of the faster motor through PWM command in order to make the speed of both motors equal so that my robot can go straight.
This is what my logic was, but dont know what it doesnt work. That is the reason whay i have asked u guys! Do u guys see any major flaw in this logic?
What are ur ideas to control this sort of mechanim?
Mr. Skimask! once again thanks for providing this code, but i do require some more explaination in order to understand this code. Like plz tell me how can i vary duty cycles in this?
I would be thankful to you if u plz provide some detailed explaination of this beautiful code.
Thanks in advance!
Bookmarks