serial port problems
larry at walkerenergysystems.com
Sun Nov 7 09:18:08 CST 2010
I am trying to read data from a "serial port" (using a USB-serial
I am on a MacBook Pro running 10.5.8, using LiveCode 4.5, and Prolific
model 2303 USB-serial adaptor.
The following code does not work:
put "modem:" into usbSerial
put empty into field "Field"
open driver usbSerial for text read
read from driver usbSerial for 5 chars
put it after field "field"
close driver usbSerial
Setting a breakpoint on the "read from" shows that the "open" does not
appear to fail. Single-stepping through the read does not wait for any
input from the connected terminal, it returns immediately. "It" is
By reading for N chars I believe I am side-stepping any line -
I have confirmed that the USB-serial adaptor and the terminal can talk
to each other properly, using the command-line invocation: 'screen /
dev/tty.usbserial'. I have confirmed that the serialControlString
matches the terminal's settings.
This fail whether I use "open file" or "open driver".
This fails whether I use "modem" or "printer" as the device.
If I use /dev/tty.usbserial", the IDE hangs and I have to Force-Quit it.
I have tried using the SerialTest.rev stack (http://www.troz.net/rev/stacks/SerialTest.rev
) as well: identical results.
I have read Phil Worthington's paper on serial communication (http://www.pdslabs.net/usb/rev-usb1.pdf
); I believe I'm doing just as he suggests (except for the no-name
adaptor I bought), but no luck. I did notice that "the DeviceNames"
seems to now return its results in a format different from the one
Phil describes, for whatever that might be worth (LC4.5 changes?).
Has anything changed in LC4.5 regarding serial communication? Can
others run the serialTest.rev script properly under LC4.5?
Any suggestions welcome!
Walker Energy Systems LLC
Madison, WI USA
Strategies & Technologies
More information about the use-livecode