Sensing 240V and converting to CMOS logic levels
I assume you measuring it with a voltmeter. The circuit Olin presented provides pulses every half-cycle due to D1. With an oscilloscope you would see that. 

If you want to detect the presence of 240VAC at the input, you can either stretch the output pulses with a one-shot (74HC123, 555 or whatever) or perhaps a capacitor from output to ground will do the trick if you're not too concerned about rise and fall times. Maybe try 10uF or 22uF.