Shop OBEX P1 Docs P2 Docs Learn Events
byteAvailable — Parallax Forums

byteAvailable

RL41RL41 Posts: 1
edited 2006-06-21 18:16 in General Discussion
The Uart.byteAvailable() method is not working as I expected.· My code is something like this (though I don't have it in front of me and so can't copy verbatim):

while( true ) {
· if( rxUart.byteAvailable() ) {
··· c = rxUart.receiveByte();
··· System.out.println( c );
· }
}

The observed result of this is a long string of zeros when there is no data being transmitted.· The expected effect would be that nothing is printed when no data is transmitted.· Why the difference?· Thanks.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-21 18:16
    My guess is that the pin for the receive uart is floating.
    Connect a 10k pullup or pulldown resistor to that pin
    or connect that pin to a rs232 level driver like max232.
    That stops the pin from floating and picking up noise.

    regards peter
Sign In or Register to comment.