First, have a clock pulse that periodically check the AI for value and make decision:
Clk:1.0s Fn_#1
|--||-----------{dCusF}
With Fn_#1, do the following:
S = ADC(1) * xxx/ yy ' convert to your scale for speed
D = ADC(2) * aa/bb ' convert to you direction
IF S > ?? THEN
IF D >
SETIO OUT1
ELSE
CLRIO OUT1
ENDIF
ENDIF
You will have to fill in the formula for analog conversion to your unit (See FAQ forum) and the If then else statement will need to be modified to make a decision on what you want to do, e.g. turn ON or OFF an output with label name OUT1.
The above may be the complete program to do what you said you want to achieve. It is unbelievably simple, but it is real.