Just to rule out the basics, if you ground the input, do you get a consistent '0'? and connect it to +5, do you get a consistent '255'?