hrmm, something isn't right...

[code]

CMCON = 7 ' Disable analog comparator
TRISA = %11110110 ' set PORTA to input
TRISB = %11110000 ' set PORTB to output
DEFINE HSER_BAUD 9600 'send serial data at 2400 baud

UP VAR PORTB.5
DOWN var PORTB.7
FM VAR PORTB.2

POSITION var word 'Position value
VELOCITY var word 'Average velocity value
FUNCTION var word 'Function register
I var byte 'Loop variable

TRISB.5 = 1
TRISB.7 = 1

MAIN:

if UP THen
serout FM, T9600 ,["W01 01 200", CR, LF] 'Write velocity limit value
serout FM,T9600,["P01 270000", CR, LF] 'Send MOVETO_ABSOLUTE command

for I = 1 to 100
pause 25
serout FM,T9600,["R01 00",CR,LF]
serout FM,T9600,["R01 14",CR,LF]
next
endif

if DOWN THEN
serout FM, T9600 ,["W01 01 200", CR, LF] 'Write velocity limit value
serout FM,T9600,["P01 0", CR, LF] 'Send MOVETO_ABSOLUTE command

for I = 1 to 100
pause 25
serout FM,T9600,["R01 00",CR,LF]
serout FM,T9600,["R01 14",CR,LF]
next
endif

goto MAIN

END

[code/]

I am trying to see which pin is high, RB7 or RB5 and then send the right command to the motor driving circuit. No movement however :\