IRLED1 var PORTB.0
Servo var PORTB.1

TRISB=%00000001

Loop:
If IRLED1 =1 then
Pulsout 0,130
pause 10
pulsout 0,150
else
pulsout 0,150
endif
Goto Loop

End
This is the code I made do you think this might work?

Basically I want it to read the input and if the proximity sensor is activated then have it move the servo all the way to the right or left.

To find the center of the servo
I knew that dead center was 1.5ms and since I am using a 4mhz crystal the time interval of PULSOUT is in units of 10 us.

So I used this equation to find my pulse
1.5ms = 1500us
and then 1500/10= 150

and clockwise is 1.3ms so I did the same equation for that