Motor Stepper Example


Results 1 to 40 of 135

Threaded View

  1. #26
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Motor Stepper Example

    the schematic above is the one i used to...

    i am using pic16f84 and uln2803...

    here is the code:

    define osc 4
    ti var byte
    c var byte
    z var byte
    ti=40
    trisb=0
    open:
    for z=0 to 25
    portb=128
    pause ti
    portb=64
    pause ti
    portb=32
    pause ti
    portb=16
    pause ti
    next z
    goto delay

    open1:
    for z=0 to 25
    portb=128
    pause ti
    portb=64
    pause ti
    portb=32
    pause ti
    portb=16
    pause ti
    next z
    goto delay3

    close:
    for z=0 to 25
    portb=16
    pause ti
    portb=32
    pause ti
    portb=64
    pause ti
    portb=128
    pause ti
    next z
    goto delay1

    close1:
    for z=0 to 25
    portb=16
    pause ti
    portb=32
    pause ti
    portb=64
    pause ti
    portb=128
    pause ti
    next z
    goto delay4

    delay:
    portb=0
    pause 2000
    goto close

    delay1:
    portb=0
    pause 2000
    goto loop
    delay2:
    portb=0
    pause 2000
    goto open1

    delay3:
    portb=0
    pause 2000
    goto close1

    delay4:
    portb=0
    pause 2000
    goto loop1
    delay5:
    portb=0
    pause 2000
    goto open

    loop:
    for c=0 to 275
    portb=12
    pause ti
    portb=6
    pause ti
    portb=3
    pause ti
    portb=9
    pause ti
    next c
    pause 2000
    goto delay2

    loop1:
    for c=0 to 275
    portb=9
    pause ti
    portb=3
    pause ti
    portb=6
    pause ti
    portb=12
    pause ti
    next c
    goto delay5
    end
    Last edited by thenew; - 7th March 2011 at 15:15.

Members who have read this thread : 4

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