If I've understood your question correctly, you want to send a 1 to the micro if voltage is 24v, and 0 to the micro if it's less than that, yes?
Simplest way is with a comparator. You set the inverting input at a reference voltage, and send the voltage you want to test to the non-inverting input. The comparator will output a 1 if the voltage under test is higher than the reference, or a 0 if it's lower. If you use a comparator with an open collector output (I'm assuming you can get these, I don't know for sure), connect a pullup resistor between the comparator output and the micro's supply line to get the correct voltage (5v, in your case) for the logic 1. This is ONLY useful if the comparator output is open collector. If this isn't an option, just bung the output through a potential divider.
The comparator's supply voltage needs to be higher than the voltage you want to test.
24 volts is a little high to work with, so you should probably put the 24v through a potential divider to get a more "friendly" level.
Hope this helps