18f4431; driving a stepper IN HARDWARE mode


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42

    Default 18f4431; driving a stepper IN HARDWARE mode

    hi everyone,
    i have the pic18fxx31 datasheet all printed out and bound into a book, and i read it every spare time i can get.
    so the other day, i was looking at the power control module (page 181) and started thinking about how to drive a stepper with it. i looked closely at the pwm output override section, (page 202), and an idea hit me. use the OVDCOND register to determine which pwm output pins turn on, irrespective of the duty cycle. in short, on/off control of any pwm pin, AND 14-bit duty cycle control of any pwm output pin AT THE SAME TIME.
    i tried it with this simple code and it works on a stepper and leds, in my QL200 dev board
    Code:
    main
         ADCIN 0, DUTY_ADJ            ;read value on pot
         DUTY = DUTY_ADJ*64           ;bring up 8 bit adc value to 14 bit duty value
         PDC0L = Duty.LowByte         ;load duty value into duty registers
         PDC0H = Duty.HighByte        ;
         PDC1L = DUTY.LOWBYTE         ;
         PDC1H = DUTY.HIGHBYTE        ;
         PDC2L = Duty.LowByte         ;
         PDC2H = Duty.HighByte        ;
         PDC3L = DUTY.LOWBYTE         ;
         PDC3H = DUTY.HIGHBYTE        ;
         OVDCOND = %10000000          ;use override control to switch pwm pins
         PAUSE 10                     ;pause
         OVDCOND = %00100000          ;
         PAUSE 10                     ;
         OVDCOND = %00001000          ;
         PAUSE 10                     ;
         OVDCOND = %00000010          ;
         pause 10                     ;
         goto main                    ;loop
    stepper power is controlled by the value of the duty cycle. in this example, all the duty registers have the same value (from the adcin 0),but its possible to have different duty cycles.
    for the 18f4431, you get four individual duty cycle control, thus perfect compatibility with a stepper motor. im highly interested in motor control for cnc applications. i would really appreciate all the help i can get, to implement into this idea:
    • ramping up/down ideas
    • current limiting by varying the duty cycle
    • current feedback
    • any other stepper optimization technology/ideas
    thanks for reading.
    Last edited by DDDvvv; - 19th January 2010 at 17:49.
    NAG CON WIFE!
    WIFE VAR MOOD

Similar Threads

  1. 18F4431 - Complementary mode PWM
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 15th December 2011, 11:23
  2. Driving two stepper motors at the same time
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th February 2010, 17:33
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Driving Stepper Motor with PBL3717
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th November 2007, 20:59
  5. Driving a stepper motor bipolar
    By debutpic in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th June 2007, 17:34

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts