Unable to read PC serial port

Ken G. Brown kbrown at tnc.com
Wed Aug 22 12:23:12 UTC 2001


At 21:46 -0700 on 2001/08/21,  Ned Konz is rumored to have written:
><snip>
>Are you _sure_ you have hardware flow control? Are you _sure_ it's wired
>right?

I tried on two different ports, one with hardware flow control, one 
without. Hyperterm works with the external device on either port, 
with and without hardware flow control depending on the port.

>  > p readInto: q startingAt: 1.
>
>Remember that readInto:startingAt: won't block (we don't have the API for
>that). So you have to look at the return value from this call to see if you
>actually got any bytes. The returned value will be > 0 if you did (and you
>can then use that many bytes).

Ok, I was wondering about that.

>What you're seeing is your uninitialized string with 0 bytes having been read
>into it.

The cursor moved in the Transcript but only blanks were displayed. 
Inspecting the String variable showed 0's had been added it seemed.

>Look at readString and readByteArray which return empty strings and/or byte
>arrays if nothing is read.
>
>Why don't you test this first with a loopback: connect pin 2 to 3 (assuming a
>DE-9 or DB-25 connector), don't use hardware handshaking (comment out the
>*flowControlType: commands), and then see if you get what you send. You have
>too many variables if you're also trying to talk to an external device before
>you know that you can communicate.

Good idea. I was confident tho, that I was indeed getting stuff 
incoming on the port as I was watching in Hyperterm on the second 
port. Same stuff was coming from the external device on both ports, 
one with flow control, one without, triggered by the 'b' sent out.

Thx for the response,
Ken
>--
>Ned Konz
>currently: Stanwood, WA
>email:     ned at bike-nomad.com
>homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list