---
+ Post New Thread
Results 1 to 6 of 6
  1. #1
    Newbie level 3
    Points: 952, Level: 7

    Join Date
    Sep 2007
    Posts
    4
    Helped
    0 / 0
    Points
    952
    Level
    7

    dc motor driver circuit

    hello,
    I am making a motor driver circuit using PIC16f877 microchip, dual full bridge driver L298 and L6210(diode chip)...I have been able to form a circuit but dont know how to programme my PIC chip...what i want to do is that i want to move the motor in both dirrections, depending on the input....can any one please help in giving me the PIC code to make my motor run in both dirrections using the components i have mentioned above...i will be extremely gratefull...thnx.

    •   Alt15th September 2007, 01:34

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 18,155, Level: 32

    Join Date
    Jul 2001
    Location
    Oberon
    Posts
    1,889
    Helped
    423 / 423
    Points
    18,155
    Level
    32

    dc motor speed with picbasic

    Check out the application notes at Microchip. There is a section on motor control. Im sure you will find something that you can adapt to suit what you need.
    Full source code is provided.



    •   Alt15th September 2007, 10:51

      advertising

        
       

  3. #3
    Full Member level 5
    Points: 4,033, Level: 14

    Join Date
    Mar 2002
    Posts
    301
    Helped
    12 / 12
    Points
    4,033
    Level
    14

    pic basic sample code, dc motor control




    •   Alt15th September 2007, 11:14

      advertising

        
       

  4. #4
    Member level 5
    Points: 2,089, Level: 10

    Join Date
    Sep 2007
    Posts
    78
    Helped
    16 / 16
    Points
    2,089
    Level
    10

    dc motor speed control picbasic pro

    Well PIC is quite a broad functionality chip...and its quite easy...
    to program it you can even use BASIC to program...to learn about programming in basic search the net regarding PIC BASIC PRO and you'll get the compiler...
    the simple forward reverse program for a PIC in basic is as below...when key is pressed at pin 1 of PortA then it will activate the Pin 1 of PortB on which the forward pin for motor is connected and when pin 2 of PortA then it will activate then Pin 2 of PortB on which the reverse pin for motor is connected


    TRISA = %00000000
    TRISB = %00000000
    loop:
    if PORTA.0 = 1 then
    PORTB.0 = 1
    PORTB.1 = 0
    endif
    if PORTA.1 = 1 then
    PORTB.1 = 1
    PORTB.0 = 0
    endif
    goto loop
    end



  5. #5
    Newbie level 3
    Points: 952, Level: 7

    Join Date
    Sep 2007
    Posts
    4
    Helped
    0 / 0
    Points
    952
    Level
    7

    forward and reverse of dc motor circuit

    hey guys..thnx a lot...did not expect so many people would reply:) thnx all of you for ur help....just one more thing if any one of you has some time...can any of you provide the code for controlling the speed of the motor and also for stopping it after it makes certain number of cycles...thnx a lot once again :)



  6. #6
    Member level 5
    Points: 2,089, Level: 10

    Join Date
    Sep 2007
    Posts
    78
    Helped
    16 / 16
    Points
    2,089
    Level
    10

    dc motor drive using pic

    well as you said you're using a DC Motor so...for DC Motors there quite a number of defficiencies...
    1. Speed is never constant as it depends on the current which you're providing...
    2. Number of rotations is also never constant as it also depends on the current...
    Note: DC motors draw a huge ammount of current during start...so that causes the above 2 reasons to occur...


    now as you need to control the speed of dc motor, its not impossible but not even easy...well to control the speed of DC motor you can use a variable resistor to control the input current, but as you need to do this automatically so you need to use a MOS as it can act as a variable resistor depending on the current being provided at the gate, so for this purpose you will also need a Digital to analog convertor which will convert the digital signals from the microcontroller to variable bit pattern which will be provided to the gate of the MOS which will then act as a variable resistor and in accordance to the channel being developed between the drain and source the current will pass, this will crete a variation of speed.
    and as for the number of turns is concerened so thats completely impossible to take control of the rotations as the rotations of the dc motor vary from time to time depening of whats the load and what the current being provieded...



    the best soulution for motor controlling is to use a STEPPER MOTOR instead of a DC Motor as stepper motors are completely under your control for each and every pulse and by the variation of pulse you can measure the turns and the number of ratations along with the speed.



    warning: stepper motors can not sustain huge loads so if yo're using the motor to drive a heavy load then the best solution is to use DC Motor but if its for a small application or demonstration then Stepper Motor is the best solution


    1 members found this post helpful.

+ Post New Thread
Please login