As you are using CSMIO, as Paulus mentioned, this will take the prox sensor 24V directly. It has taken me a while to find my original drawing but for anyone with a cheap 5V BoB this is what I had to do to get it work. Without the diodes it was very unreliable at triggering. With the diodes it is 100%. Maybe these should be fast acting types, but mine were regular types and the homing is very repeatable. Sorry for the side track on the OP.

Click image for larger version. 

Name:	prox_24V_to_5V_using 10K pullup and diode.png 
Views:	3501 
Size:	27.3 KB 
ID:	26395