program stepperNOW630
main:
DIM t as byte
TRISA = %00000000
PORTA = %00000000
TRISC = %00110000
PORTC = %00000000
CMCON =0x07
IF (BUTTON(PORTC,5,1,0))then GOTO up
END IF
IF (BUTTON(PORTC,4,1,0))then GOTO down
END IF
GOTO main
up:
FOR t = 1 to 50
PORTA = %00000001
PORTC = %00000001
delay_ms (10)
PORTA = %00000011
PORTC = %00000000
DELAY_MS (10)
PORTA = %00000110
PORTC = %00000000
delay_ms (10)
PORTA = %00000100
PORTC = %00000001
DELAY_MS (10)
NEXT t
GOTO main
down:
FOR t = 1 to 50
PORTA = %00000100
PORTC = %00000001
delay_ms (10)
PORTA = %00000110
PORTC = %00000000
DELAY_MS (10)
PORTA = %00000011
PORTC = %00000000
delay_ms (10)
PORTA = %00000001
PORTC = %00000001
DELAY_MS (10)
NEXT t
GOTO main
end.