programming stepper motor using C

Discussion in 'Programmer's Corner' started by saeight_87, Apr 8, 2010.

  1. saeight_87

    Thread Starter New Member

    Apr 8, 2010
    1
    0
    can anyone help me in write the coding in C to control the stepper motor based on the intensity of solar energy received. project use the 4 photoresistor to compare the voltage for every output from the photoresistor circuit. used PIC 16F877A
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    Hello,

    What is the function and the connection diagram of the PIC?

    Bertus
     
  3. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Without knowing how your circuit is wired, It would be impossible to write your code.

    But a little help.. You can use the on board ADC to get the readings from the photosensors and then use the result to vary the PWM to the stepper motor driver
     
  4. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    No PWM, this is a stepper system.

    Would it be sufficient just to say "If A+ > A-, run the motor at some reasonable speed"?

    That makes the control algorithm very simple. Start with something to run the motor when you press a button connected to an input pin (Port B is best for this, as it has internal pullups) and then develop the control via the analog inputs.
     
Loading...