Subject: Re: Example serial code - DN [1]


Scott Redman <redman@scriptics.com> - 11 May 1999 - comp.lang.tcl

 # excuse me if I make a mistake, this is off the
 # top of my head....

 # substitute your serial port for com1:, such
 # as /dev/ttya on Solaris

 set serialPort com1:

 proc readData {port} {

     if [eof $port] {
         close $port
     } else {
         gets $port
     }
 }

 set port [open $serialPort RDWR]
 fconfigure $port -blocking 0 -buffering none -mode 9600,o,8,1

 fileevent $port readable [list readData $port]
 puts $port "start"

 Andy Hunt wrote:
 >
 > Hi,
 >
 > I'm on the point of having to write some code to control a motorised
 > microscope stage via a serial controller. Has anyone got any code
 > examples on how to interact with the serial port, I need more than just
 > the snippets in the manual.
 >
 > Thanks
 >
 > Andy
 > Andy Hunt
 > Software Engineer
 > Foster Findlay Associates

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated