Serial comm differences between PC & Mac?

runrev at jkvaldez.com runrev at jkvaldez.com
Thu Dec 2 16:06:42 EST 2004


Gordon, great suggestion! Unfortunately when I altered my parity settings
in any manner I actually got more superfluous characters than before on
OSX, so I didn't try on  my PC. (BTW, your app sounds really interesting!
I'd like to know more about it off list.)

Dar, you're the expert of experts on Rev & serial comm: Thanks for your
reply! Before I answer your question, I should tell you I'm trying to
access call data (SMDR) from our Legend phone system. It uses a modified
DB9 adapter, but the adapter appears to work fine. I can, for example, use
it to program the phone system.

To answer your questions:

Yes, the port is closed before plugging in the cable. (I'm now making
double-sure to check it.)

Sorry, but I'm new to serial comm so I don't know specifically how to
"sync on something good" with rev. If you have a code snippet handy.... :)

Regarding char, I'm not getting good results using it. With char, it
usually just sits there & is slow to collect the data (but I think it does
work, just not very well). When I use int1, I can see all of the activity,
including control chars. But on my XP box, I see strange numbers that I
never get on the mac. Maybe I'll try on my Linux box, but it's a strange
inconsistency! (See below for an example.)

Yeah, my serialControlString is set to "BAUD=1200 PARITY=N DATA=8 STOP=1".

And the weird part is yes, the data I expect does come across ok,
generally speaking. See, I sometimes get these strange characters in
between, but the characters are there.

Here's an example. I'll read from the serial port in OSX:

6 67 32 49 50 47 48 50 47 48 52 32 49 52 58 51 56 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 73 78 32 32 48 48 58 48 48 58 49 55 32 32 32 56
48 57 32 32 52 50 51 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 13 10 7 5 5 4 5 6 5 6 4

Using numToChar() on each value CORRECTLY reveals:
C    12/02/04    14:38    IN    00:00:17    809    423

But in XP, I read:
-52 67 32 49 50 47 48 50 47 48 52 32 49 52 58 52 52 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 73 78 32 32 48 48 58 48 48 58 52 55 32 32 32
56 49 48 32 32 52 48 48 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 13 10 12 -100 12 -100 12 -100 -100 -100 -100 12 -84 12

Which CORRECTLY turns into:
C    12/02/04    14:44    IN    00:00:47    810    400

But notice the first few values in each raw data list. In OSX, I read 6 (a
control char) then 67 (which is "C" & is the beginning of the call data).
After the data, I get more control chars  4, 5, 6, & 7.

In XP, I first read -52! What's that? Then the trailing control chars are
12, -100, -84, etc. Strange.

Anyway, thank you both so much for the helpful advice!



More information about the use-livecode mailing list