serial port problems

Erik Schwartz eriks at sisyph.us
Sun Nov 7 11:02:01 EST 2010


I have had problems with 4.5 and serial comms. I have not had time to
diagnose it properly. I just regressed back to use 4.0 until the bugs
in 4.5 get dealt with (kind of annoyed that I paid for the upgrade I
can't use yet though). I hope you get it figured out.

Erik



On Sun, Nov 7, 2010 at 10:18 AM, Larry Walker
<larry at walkerenergysystems.com> wrote:
> I am trying to read data from a "serial port" (using a USB-serial adaptor).
>
> 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:
>
> on mouseUp
>   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
> end mouseUp
>
> 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 empty
> afterward.
>
> By reading for N chars I believe I am side-stepping any line -terminator
> issues.
>
> 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?

-- 
==========================================
eriks at sisyph.us                                  http://sisyph.us
(530) 213-ERIK                          http://twitter.com/eriks
(530) 213-3745   http://www.linkedin.com/in/erikschwartz
==========================================



More information about the Use-livecode mailing list