You definitely want an
if statement.
Code:
if ( (p1_x > 122) && (p1_x < 132) && rc_dig_in01 )
pwm11 = 50;
I'm assuming you intend to drive a motor backwards until it reaches a set position and activates a limit switch.
Note that I made it test to see that p1_x is in a range around 127, instead of exactly 127. Joysticks will almost never return to exactly center when you let go of them, and the center point will sometimes change with time.