Hi.
Im trying to make a stepper motor move right or left with this pic.
I've connected everything according to examples and the datasheets but still no movement.
i guess its my code and im missing something. i would really appreciate if someone can please point me in the right direction.
DEFINE ADC_CLOCK 3
steps var word
stepArray var byte(4)
CMCON = 7
TRISA = 1
TRISB = %11110000
PORTB = %11111111
input porta.0
input porta.1
stepArray[0] = %00001010
stepArray[1] = %00000110
stepArray[2] = %00000101
stepArray[3] = %00001001
pause 500
main:
if porta.1 = 1 then
steps = steps + 1
endif
if porta.0 = 1 then
steps = steps -1
endif
PORTB = stepArray[steps // 4]
pause 3
goto main
the motor is connected on port b - 0-3 and the buttons are on pins a0 and a1
anyone?
thanks in advance,
Shahar
Bookmarks