Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top