To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 5867
5866  |  5868
Subject: 
Help with Serial Ports, Please !!!
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Sat, 20 Mar 1999 00:51:44 GMT
Original-From: 
Andre Philippi <PHILIPPI@EARTHLINK.stopspamNET>
Viewed: 
1033 times
  
Hello,

I'm trying to port some working Qbasic code to Tcl8.08 (NT4.0),
so I can embed it into the tcl-httpd, and make a robotic application
controllable from the web (with the Tcl plug-in), but I'm having a hard
time configuring the serial port under Tcl...

Could you help me, please?

The Qbasic and the Tcl code are verty short, and follow bellow...

To help debugging, I have an "RS-232 Mini-Tester" (from Radio Shack)
attached to the serial port, so I can see (some) of what's going on...
On the tester, there are several LEDs that can become red, green, or
clear (off)... The Mini-Tester has LEDs for: TD,RTS,DSR,CD,RD,CTS and
DTR.

Under the QBASIC code below; on standby; the TD led is red,
the RTS and DTR leds are green, and the others are clear...
When the Qbasic program runs, RTS flashes from green to red (for
a second), then back to green; every other led remain the same,
and then the servo moves perfectly fine :)

Under the Tcl code below; on standby;  the TD, RTS and DTR leds
are red, and all of the other leds are clear...
When the Tcl code runs, the TD, RTS and DTR leds flash from
red to green (for a second), then back to red; every other led
remains the same, and nothing happens with the servo, meaning
failure... :(

Does anyone here know what is going on?

I suspect it has something to do with the CD0,CS0,DS0 and OP0
arguments of the OPEN statement on the Qbasic code, because
I removed the above mentioned arguments from the Qbasic code,
and the program didn't work anymore... But I neither know what
those arguments do, nor how to port them to Tcl...

Any help would be appreciated,

Thank you in advance,

Andre Philippi.

#-------------------- serial.tcl --------------------#

set device {COM2}
set sync {255}
set servo {0}
set position {0}

set fd [open $device {WRONLY}]
fconfigure $fd -mode 9600,N,8,1 -buffering none

puts -nonewline $fd [format {%c} $sync]
puts -nonewline $fd [format {%c} $servo]
puts -nonewline $fd [format {%c} $position]

#----------------------------------------------------#


#-------------------- serial.bas --------------------#

sync = 255
servo = 0
position = 0

OPEN "com2:9600,N,8,1,CD0,CS0,DS0,OP0" FOR OUTPUT AS #1

PRINT #1, CHR$(sync);
PRINT #1, CHR$(servo);
PRINT #1, CHR$(position);

#----------------------------------------------------#



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR