How to polled programmed input output operation?