Code:
If index = 1 then use_pin = portB.5
Won't do what you want. use_pin will be be assigned the value of PortB.5 (1 or 0), you can't change aliases at runtime.

Do it the way Richard shows.

/Henrik.