Motor Pap

Páginas: 3 (567 palabras) Publicado: 20 de junio de 2012
purposely made this first program as small as possible, simply to demonstrate how easy it is to control a stepper motor. Also note the use of high and low commands to control the output lines, ratherthan peek and poke routines. For our purposes, high and low are sufficient.
Listing 1
' First stepper motor controller program
' Rotates motor at set speed forever
Symbol delay = B0
delay = 25loop:
high 0
pause delay
low 0
high 1
pause delay
low 1
high 2
pause delay
low 2
high 3
pause delay
low 3
goto loop
' use b0 as the delay variable
' set the delay to 25 ms

' turn on Q1
'wait 25 ms
' turn off Q1
' turn on Q2
' wait 25 ms
' turn off Q2
' turn on Q3
' wait 25 ms
' turn off Q3
' turn on Q4
' wait 25 ms
' turn off Q4
' forever

Listing 1
listing 2
' Second stepper motorcontroller program
' Responds to user input by changing speed or direction
Symbol delay = B0
delay = 100

forward:
high 0
pause delay
low 0
high 1
pause delay
low 1
high 2
pause delay
low 2high 3
pause delay
low 3
goto check

reverse:
high 3
pause delay
low 3
high 2
pause delay
low 2
high 1
pause delay
low 1
high 0
pause delay
low 0
goto check

check:
if pin4 = 0 thentimeup
if pin5 = 0 then timedn
if pin6 = 0 then halt
if pin7 = 0 then reverse
goto forward

timeup:
delay = delay + 5
pause 50
if delay > 250 then max
if pin4 = 0 then timeup
goto checktimedn:
delay = delay - 5
pause 50
if delay <20 then min
if pin5 = 0 then timedn
goto check

halt:
if pin6 = 0 then halt
goto check

max:
delay = 245
goto check

min:
delay = 25
goto check' use b0 as the delay variable
' delay will begin at 100 ms

' turn on Q1
' wait for delay ms
' turn off Q1
' turn on Q2
' wait for delay ms
' turn off Q2
' turn on Q3
' wait for delay ms
' turn offQ3
' turn on Q4
' wait for delay ms
' turn off Q4
' check the status of switches

' turn on Q4
' wait for delay ms
' turn off Q4
' turn on Q3
' wait for delay ms
' turn off Q3
' turn on Q2
' wait for...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Motores pap
  • Cncn motor pap
  • control motor pap con arduino
  • Principio de funcionamiento de un motor pap
  • Motores pap
  • Motor Pap
  • Motores Pap
  • Motores Pap

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS