Reading Serial Port in VW 7.9.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Reading Serial Port in VW 7.9.1

William Blake
Dear Sirs/Madams,

I want to control a device via the serial port on Linux using Visualworks
Smalltalk 7.9.1. It works like I send some characters over the com and get a
bunch of characters back.
I stole some code from the internet and mixed it together, the resulting
script is at the end of my message. The connection with the port works and I
can send messages over the line, which surprised me since I used a "read"
method. My question is:

How can I read out the characters coming back via the com-port, listen to it?

Would be nice if someone could enlighten me.

Thanks a lot for answering.

Best Regards,

William

| tty options IO conn |
UnixTtyAccessor hookupTo: 'ignored sys5 ignored'.
tty := UnixRealTtyAccessor open: '/dev/ttyS1'.
options := tty getOptions.
options
        speed: 9600 ; "9600 baud"
        setBinary ;
        parity: nil.
tty setOptions: options.
tty ifNil: [ "something went wrong with the open" ]
ifNotNil: [
        "send some bytes"
        conn := ExternalConnection ioAccessor: tty.
        IO := ExternalReadAppendStream on: conn.
        IO lineEndLF.
        IO nextPutAll: 'Test.'.
        IO flush.
].



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc