Stepper Motor Program


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    It has been awhile since I stamped, but this should get you going with PIC BASIC.
    http://www.picbasic.co.uk/forum/show...hlight=stepper
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Oct 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Solved

    Thanks for that, got it working not as elegantly as the first program but it does the job.
    Here is the code, any suggestions on making it a bit more elegant wouild be appreciated.

    DEFINE OSC 4

    TRISB = %00000000

    speed var word
    i var byte
    speed = 10

    Main:
    FOR i = 1 TO 50 ' one revolution
    GOSUB Step_Fwd ' rotate clockwise
    NEXT i
    PAUSE 500 ' wait 1/2 second
    FOR i = 1 TO 50 ' one revolution
    GOSUB Step_Rev ' rotate counter-clockwise
    NEXT i
    PAUSE 500 ' wait 1/2 second
    GOTO Main
    END

    Step_Fwd:
    portb = %1001
    pause speed
    portb = %1100
    pause speed
    portb = %0110
    pause speed
    portb = %0011
    pause speed
    return

    Step_Rev:
    portb = %0011
    pause speed
    portb = %0110
    pause speed
    portb = %1100
    pause speed
    portb = %1001
    pause speed
    return

Similar Threads

  1. 18f4431; driving a stepper IN HARDWARE mode
    By DDDvvv in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st January 2010, 17:49
  2. Replies: 11
    Last Post: - 6th November 2008, 11:27
  3. Controlling stepper motor with PIC
    By The Master in forum Off Topic
    Replies: 3
    Last Post: - 1st July 2008, 11:21
  4. Driving Stepper Motor with PBL3717
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th November 2007, 21:59
  5. problem with stepper!!
    By ibra in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th August 2007, 17:41

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