TCL\TK serial communication

Status
Not open for further replies.

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
tcl/tk serial communication com1

hi psubiaco

im really stressing out about finding this error about the "flush" command in tcl, it dosn't fluch the out put when i use the following script, thing is it works in the "wish" commmand line when i do it line by line, but dosn't work for when i do the whole thing all at once.

entry .u -textvar "new" ;pack .u
button .y -text "Goooo" -command {serial_proc};pack .y


proc serial_proc {} {
global input #pass_input_LRS pass_input_PL pass_input_UL pass_input_PHOR

#setuot serial port
set serial [open com1 "r+"]
fconfigure $serial -mode "9600,n,8,1"
fconfigure $serial -blocking 0 -buffering full -ttycontrol {RTS 0 DTR 1}

puts -nonewline $serial "A" ;

flush $serial

set data5 [fconfigure $serial -queue]

.u insert 0 $data5

}
-----------------

after all things are done correctley i should have in the entry box the value of {fconfigure $serial -queue} which is somthing like {4 0} input output respectivley, but i get {0 1} which means that flush is not working when i execute the script all at once,
any ideas gurus
 

Try this bro;
-entry .u -textvar "new" ;pack .u
button .y -text "Goooo" -command {serial_proc};pack .y
entry .xz -textvar "new2" ;pack .xz


proc serial_proc {} {
global input #pass_input_LRS pass_input_PL pass_input_UL pass_input_PHOR

#setuot serial port
set serial [open com1 "r+"]
fconfigure $serial -mode "9600,n,8,1"
fconfigure $serial -blocking 0 -buffering full -ttycontrol {RTS 0 DTR 1}

after 500
puts $serial "A"

after 500
flush $serial

after 500
set data5 [fconfigure $serial -queue]
set data6 [read $serial]

.u insert 0 $data5
.xz insert 0 $data6
}

-------------

take care
adios

sonny
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…