# (c) by dinus van breugel # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License (either version 2 or # version 3) as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # For more information on the GPL, please go to: # http://www.gnu.org/copyleft/gpl.html # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # THIS PROGRAMM IS FAR FROM READY ! IT IS A DRAFT !! # # SOFAR ONLY TESTED WITH: tcl/tk version 8.5 # # Linux (I don't have windows) # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #!/bin/sh #\ exec wish "$0" "$@" wm title . "TCL/TK ETHERSEX-MULTI-FRONTEND + RS232-SWITCH" #============================================================= #=== frame header ==== #============================================================= frame .c grid .c -column 0 -row 0 button .c.node -width 20 -text "Select node" -background PeachPuff -command node grid .c.node -column 0 -row 1 -columnspan 9 button .c.progsel -width 60 -text "Select programm" -background PeachPuff -command progsel grid .c.progsel -column 9 -row 1 -columnspan 10 #ruimte horizontaal label .c.space -pady 8 grid .c.space -column 0 -row 10 #ruimte vertikaal label .c.space2 -text " " grid .c.space2 -column 3 -row 2 #============================================================= #==== variables construction ==== #============================================================= # Initial values # Construction of the variables: # Portpin is fi. a0 for PA0 # ba0 = the button # la0 = a label # pa0 = a function switch # ipa0 = the I/O function switch # ia0 = IN or OUT (direction) # ba0_ = background of button ba0 # ba0__ = conversion of variable ba0 #============================================================== #=== PORT A ==== #============================================================== #init set adc0 0.1 set adc1 0.2 set adc2 0.3 set adc3 0.4 set adc4 0.5 set adc5 0.6 set adc6 0.7 set adc7 0.8 set adc0_ green set adc0__ [format "%5.3f V" $adc0] set adc1_ green set adc1__ [format "%5.3f V" $adc1] set adc2_ green set adc2__ [format "%5.3f V" $adc2] set adc3_ green set adc3__ [format "%5.3f V" $adc3] set adc4_ green set adc4__ [format "%5.3f V" $adc4] set adc5_ green set adc5__ [format "%5.3f V" $adc5] set adc6_ green set adc6__ [format "%5.3f V" $adc6] set adc7_ green set adc7__ [format "%5.3f V" $adc7] button .c.a0 -text $adc0__ -background green -relief solid -width 5 -command {A0} button .c.a1 -text $adc1__ -background green -relief solid -width 5 -command {A1} button .c.a2 -text $adc2__ -background green -relief solid -width 5 button .c.a3 -text $adc3__ -background green -relief solid -width 5 button .c.a4 -text $adc4__ -background green -relief solid -width 5 button .c.a5 -text $adc5__ -background green -relief solid -width 5 button .c.a6 -text $adc6__ -background green -relief solid -width 5 button .c.a7 -text $adc7__ -background green -relief solid -width 5 grid .c.a0 -column 5 -row 2 grid .c.a1 -column 5 -row 3 grid .c.a2 -column 5 -row 4 grid .c.a3 -column 5 -row 5 grid .c.a4 -column 5 -row 6 grid .c.a5 -column 5 -row 7 grid .c.a6 -column 5 -row 8 grid .c.a7 -column 5 -row 9 set pa0 1 set pa1 1 set pa2 1 set pa3 1 set pa4 1 set pa5 1 set pa6 1 set pa7 1 button .c.pa0 -text PA0 -background yellow -foreground black -relief solid -width 1 -command {PA0} button .c.pa1 -text PA1 -background yellow -foreground black -relief solid -width 1 -command {PA1} button .c.pa2 -text PA2 -background yellow -foreground black -relief solid -width 1 button .c.pa3 -text PA3 -background yellow -foreground black -relief solid -width 1 button .c.pa4 -text PA4 -background yellow -foreground black -relief solid -width 1 button .c.pa5 -text PA5 -background yellow -foreground black -relief solid -width 1 button .c.pa6 -text PA6 -background yellow -foreground black -relief solid -width 1 button .c.pa7 -text PA7 -background yellow -foreground black -relief solid -width 1 grid .c.pa0 -column 4 -row 2 grid .c.pa1 -column 4 -row 3 grid .c.pa2 -column 4 -row 4 grid .c.pa3 -column 4 -row 5 grid .c.pa4 -column 4 -row 6 grid .c.pa5 -column 4 -row 7 grid .c.pa6 -column 4 -row 8 grid .c.pa7 -column 4 -row 9 #============================================================== #==== PORT B ===== #============================================================== # init set b0 "IN" set b0_ red set bb1 "OUT" set bb1_ red set bb2 "IN" set bb2_ lightblue set bb3 "OUT" set bb3_ lightblue set bb4 "SS" set bb4_ yellow set bb5 "MSOI" set bb5_ yellow set bb6 "MISO" set bb6_ yellow set bb7 "SCK" set bb7_ yellow button .c.b0 -relief solid -width 5 -text $b0 -background $b0_ button .c.b1 -width 5 -relief solid -text $bb1 -background $bb1_ button .c.b2 -width 5 -relief solid -text $bb2 -background $bb2_ button .c.b3 -width 5 -relief solid -text $bb3 -background $bb3_ button .c.b4 -width 5 -relief solid -text $bb4 -background $bb4_ button .c.b5 -width 5 -relief solid -text $bb5 -background $bb5_ button .c.b6 -width 5 -relief solid -text $bb6 -background $bb6_ button .c.b7 -width 5 -relief solid -text $bb7 -background $bb7_ grid .c.b0 -column 0 -row 2 grid .c.b1 -column 0 -row 3 grid .c.b2 -column 0 -row 4 grid .c.b3 -column 0 -row 5 grid .c.b4 -column 0 -row 6 grid .c.b5 -column 0 -row 7 grid .c.b6 -column 0 -row 8 grid .c.b7 -column 0 -row 9 set pb0 0 set pb1 0 set pb2 0 set pb3 0 set pb4 1 set pb5 1 set pb6 1 set pb7 1 button .c.pb0 -text PB0 -background yellow -foreground black -relief solid -width 1 button .c.pb1 -text PB1 -background yellow -foreground black -relief solid -width 1 button .c.pb2 -text PB2 -background yellow -foreground black -relief solid -width 1 button .c.pb3 -text PB3 -background yellow -foreground black -relief solid -width 1 button .c.pb4 -text PB4 -background yellow -foreground black -relief solid -width 1 button .c.pb5 -text PB5 -background yellow -foreground black -relief solid -width 1 button .c.pb6 -text PB6 -background yellow -foreground black -relief solid -width 1 button .c.pb7 -text PB7 -background yellow -foreground black -relief solid -width 1 grid .c.pb0 -column 2 -row 2 grid .c.pb1 -column 2 -row 3 grid .c.pb2 -column 2 -row 4 grid .c.pb3 -column 2 -row 5 grid .c.pb4 -column 2 -row 6 grid .c.pb5 -column 2 -row 7 grid .c.pb6 -column 2 -row 8 grid .c.pb7 -column 2 -row 9 #=============================================================== #==== PORT C ===== #=============================================================== #init set bc0 "SCL" set bc0_ yellow set bc1 "SDA" set bc1_ yellow set bc2 "IN" set bc2_ red set bc3 "OUT" set bc3_ red set bc4 "IN" set bc4_ lightblue set bc5 "OUT" set bc5_ lightblue set bc6 "IN" set bc6_ red set bc7 "OUT" set bc7_ lightblue button .c.c0 -width 5 -relief solid -text $bc0 -background $bc0_ button .c.c1 -width 5 -relief solid -text $bc1 -background $bc1_ button .c.c2 -width 5 -relief solid -text $bc2 -background $bc2_ button .c.c3 -width 5 -relief solid -text $bc3 -background $bc3_ button .c.c4 -width 5 -relief solid -text $bc4 -background $bc4_ button .c.c5 -width 5 -relief solid -text $bc5 -background $bc5_ button .c.c6 -width 5 -relief solid -text $bc6 -background $bc6_ button .c.c7 -width 5 -relief solid -text $bc7 -background $bc7_ grid .c.c0 -column 5 -row 11 grid .c.c1 -column 5 -row 12 grid .c.c2 -column 5 -row 13 grid .c.c3 -column 5 -row 14 grid .c.c4 -column 5 -row 15 grid .c.c5 -column 5 -row 16 grid .c.c6 -column 5 -row 17 grid .c.c7 -column 5 -row 18 set pc0 1 set pc1 1 set pc2 0 set pc3 0 set pc4 0 set pc5 0 set pc6 0 set pc7 0 button .c.pc0 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc1 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc2 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc3 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc4 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc5 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc6 -text PC0 -background yellow -foreground black -relief solid -width 1 button .c.pc7 -text PC0 -background yellow -foreground black -relief solid -width 1 grid .c.pc0 -column 4 -row 11 grid .c.pc1 -column 4 -row 12 grid .c.pc2 -column 4 -row 13 grid .c.pc3 -column 4 -row 14 grid .c.pc4 -column 4 -row 15 grid .c.pc5 -column 4 -row 16 grid .c.pc6 -column 4 -row 17 grid .c.pc7 -column 4 -row 18 #=============================================================== #==== PORT D ===== #=============================================================== # init set bd0 "Rx" set bd0_ yellow set bd1 "Tx" set bd1_ yellow set bd2 "IN" set bd2_ red set bd3 "IN" set bd3_ lightblue set bd4 "IN" set bd4_ lightblue set bd5 "IN" set bd5_ red set bd6 "IN" set bd6_ red set bd7 "IN " set bd7_ red button .c.d0 -width 5 -relief solid -text $bd0 -background $bd0_ button .c.d1 -width 5 -relief solid -text $bd1 -background $bd1_ button .c.d2 -width 5 -relief solid -text $bd2 -background $bd2_ button .c.d3 -width 5 -relief solid -text $bd3 -background $bd3_ button .c.d4 -width 5 -relief solid -text $bd4 -background $bd4_ button .c.d5 -width 5 -relief solid -text $bd5 -background $bd5_ button .c.d6 -width 5 -relief solid -text $bd6 -background $bd6_ button .c.d7 -width 5 -relief solid -text $bd7 -background $bd7_ grid .c.d0 -column 0 -row 11 grid .c.d1 -column 0 -row 12 grid .c.d2 -column 0 -row 13 grid .c.d3 -column 0 -row 14 grid .c.d4 -column 0 -row 15 grid .c.d5 -column 0 -row 16 grid .c.d6 -column 0 -row 17 grid .c.d7 -column 0 -row 18 set pd0 1 set pd1 1 set pd2 0 set pd3 0 set pd4 0 set pd5 0 set pd6 0 set pd7 0 button .c.pd0 -text PD0 -background yellow -foreground black -relief solid -width 1 button .c.pd1 -text PD1 -background yellow -foreground black -relief solid -width 1 button .c.pd2 -text PD2 -background yellow -foreground black -relief solid -width 1 button .c.pd3 -text PD3 -background yellow -foreground black -relief solid -width 1 button .c.pd4 -text PD4 -background yellow -foreground black -relief solid -width 1 button .c.pd5 -text PD5 -background yellow -foreground black -relief solid -width 1 button .c.pd6 -text PD6 -background yellow -foreground black -relief solid -width 1 button .c.pd7 -text PD7 -background yellow -foreground black -relief solid -width 1 grid .c.pd0 -column 2 -row 11 grid .c.pd1 -column 2 -row 12 grid .c.pd2 -column 2 -row 13 grid .c.pd3 -column 2 -row 14 grid .c.pd4 -column 2 -row 15 grid .c.pd5 -column 2 -row 16 grid .c.pd6 -column 2 -row 17 grid .c.pd7 -column 2 -row 18 #========================================================================= #===== routine per pin ======= #========================================================================= #------------------------------------------------------------------------- # general #------------------------------------------------------------------------- set last_frame "" if {$last_frame != ""} {grid forget $last_frame} set last_frame2 "" if {$last_frame2 != ""} {grid forget $last_frame2} #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # A0 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #......................................................................... # frame #........................................................................ frame .c.fa0 -borderwidth 5 -relief sunken button .c.fa0.start -text "has to be written" button .c.fa0.end -text "stop" -command {fa0_end} #......................................................................... # procedure #......................................................................... proc A0 {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.fa0 -column 9 -row 2 -rowspan 16 grid .c.fa0.start -column 0 -row 0 -columnspan 2 grid .c.fa0.end -column 2 -row 0 set last_frame ".c.fa0" } #......................................................................... # intern proc A0 #......................................................................... proc fa0_end {} { grid forget .c.fa0 } #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # PA0 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #......................................................................... # frame #........................................................................ frame .c.fpa0 -borderwidth 5 -relief sunken button .c.fpa0.start -text "has to be written" button .c.fpa0.end -text "stop" -command {fpa0_end} #......................................................................... # procedure #......................................................................... proc PA0 {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.fpa0 -column 9 -row 2 -rowspan 16 grid .c.fpa0.start -column 0 -row 0 -columnspan 2 grid .c.fpa0.end -column 2 -row 0 set last_frame ".c.fpa0" } #......................................................................... # intern proc PA0 #......................................................................... proc fpa0_end {} { grid forget .c.fpa0 } #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # A1 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #......................................................................... # frame #........................................................................ frame .c.fa1 -borderwidth 5 -relief sunken button .c.fa1.start -text "has to be written" button .c.fa1.end -text "stop" -command {fa1_end} #......................................................................... # procedure #......................................................................... proc A1 {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.fa1 -column 9 -row 2 -rowspan 16 grid .c.fa1.start -column 0 -row 0 -columnspan 2 grid .c.fa1.end -column 2 -row 0 set last_frame ".c.fa1" } #......................................................................... # intern proc A1 #......................................................................... proc fa1_end {} { grid forget .c.fa1 } #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # PA1 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #......................................................................... # frame #........................................................................ frame .c.fpa1 -borderwidth 5 -relief sunken button .c.fpa1.start -text "has to be written" button .c.fpa1.end -text "stop" -command {fpa1_end} #......................................................................... # procedure #......................................................................... proc PA1 {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.fpa1 -column 9 -row 2 -rowspan 16 grid .c.fpa1.start -column 0 -row 0 -columnspan 2 grid .c.fpa1.end -column 2 -row 0 set last_frame ".c.fpa1" } #......................................................................... # intern proc PA1 #......................................................................... proc fpa1_end {} { grid forget .c.fpa1 } #======================================================================== #==== RS232 switch ===== #======================================================================== #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #node #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #frame 1 frame .c.nod #-borderwidth -relief sunken label .c.nod.kop -text "==== select a node number ====" -background LemonChiffon label .c.nod.nummer -text "node nr" entry .c.nod.nodenr -textvariable nodenr -background LemonChiffon label .c.nod.descl -text "Description" entry .c.nod.desc -textvariable desc -background LemonChiffon label .c.nod.ipnr -text "ip" entry .c.nod.ip -textvariable nodeip -background LemonChiffon label .c.nod.ipport -text "port" entry .c.nod.port -textvariable nodeport -background LemonChiffon label .c.nod.tty -text "serial device" entry .c.nod.ttydev -textvariable ttydev -background LemonChiffon label .c.nod.sw -text "node nr switch" entry .c.nod.nodesw -textvariable nodesw -background LemonChiffon label .c.nod.pin -text "switch pin receive" entry .c.nod.nodepin -textvariable nodepinR -background LemonChiffon label .c.nod.pin2 -text "switch pin transmit" entry .c.nod.nodepin2 -textvariable nodepinT -background LemonChiffon label .c.nod.chan -text "node channel = " -background LemonChiffon2 button .c.nod.ok -text "Save" -background honeydew -relief solid -command { set nodenr$nodenr $nodenr set nodeip$nodenr $nodeip set nodeport$nodenr $nodeport set ttydev$nodenr $ttydev set nodesw$nodenr $nodesw set nodepinR$nodenr $nodepinR set nodepinT$nodenr $nodepinT set desc$nodenr $desc } set chanx "" set chan "" button .c.nod.ok2 -text "Set socket" -background honeydew -relief solid -command { if {$nodeip != ""} {set chanx [socket $nodeip $nodeport]} {set chanx [ open $ttydev RDWR ]} if {$nodeip != ""} {fconfigure $chanx -blocking 0 -buffering full} {fconfigure $chanx -blocking 0 -mode 19200,n,8,1 -buffering full} if {$nodeip != ""} {.c.chan configure -text "CONNEC: $chanx == $nodeip" -background PeachPuff} {.c.chan configure -text "CONNEC: $chanx == $ttydev" -background PeachPuff} set chan$nodenr "$chanx" .c.nod.chan configure -text "node chan$nodenr $chanx" -background LemonChiffon2 } button .c.nod.ok3 -text "Connect" -background honeydew -relief solid -command { #set chan "$chanx" set chan [set chan$nodenr] if {$nodeip != ""} {.c.chan configure -text "CONNECTED: $chan == $nodeip" -background PeachPuff} {.c.chan configure -text "CONNECTED: $chan == $ttydev" -background PeachPuff} } #frame 2 frame .c.nodr # at change from command to proc : also frame variables of the variables in global # now usable by other parts of the main-programm button .c.nodr.1 -text 1 -width 2 -background LemonChiffon -command { if {[info exist nodenr1]} {} {set nodenr1 "1"} if {[info exist desc1]} {} {set desc1 ""} if {[info exist nodeip1]} {} {set nodeip1 ""} if {[info exist nodeport1]} {} {set nodeport1 ""} if {[info exist ttydev1]} {} {set ttydev1 "/dev/ttyS0"} if {[info exist nodesw1]} {} {set nodesw1 ""} if {[info exist nodepinR1]} {} {set nodepinR1 ""} if {[info exist nodepinT1]} {} {set nodepinT1 ""} if {[info exist chan1]} {} {set chan1 ""} set nodenr $nodenr1 set desc $desc1 set nodeip $nodeip1 set nodeport $nodeport1 set ttydev $ttydev1 set nodesw $nodesw1 set nodepinR $nodepinR1 set nodepinT $nodepinT1 .c.nod.chan configure -text "node: chan1 $chan1" -background PeachPuff } button .c.nodr.2 -text 2 -width 2 -background LemonChiffon -command { if {[info exist nodenr2]} {} {set nodenr2 "2"} if {[info exist desc2]} {} {set desc2 ""} if {[info exist nodeip2]} {} {set nodeip2 ""} if {[info exist nodeport2]} {} {set nodeport2 ""} if {[info exist ttydev2]} {} {set ttydev2 "/dev/ttyUSB0"} if {[info exist nodesw2]} {} {set nodesw2 ""} if {[info exist nodepinR2]} {} {set nodepinR2 ""} if {[info exist nodepinT2]} {} {set nodepinT2 ""} if {[info exist chan2]} {} {set chan2 ""} set nodenr $nodenr2 set desc $desc2 set nodeip $nodeip2 set nodeport $nodeport2 set ttydev $ttydev2 set nodesw $nodesw2 set nodepinR $nodepinR2 set nodepinT $nodepinT2 .c.nod.chan configure -text "node: chan2 $chan2" -background PeachPuff } button .c.nodr.3 -text 3 -width 2 -background LemonChiffon -command { set nodenr 3 set nodeip "" set ttydev "/dev/ttyS0" set nodesw 16 set desc "Living Room" set nodepin b0 set nodepin2 b1 } button .c.nodr.4 -text 4 -width 2 -background LemonChiffon -command { set nodenr 4 set nodeip "" set ttydev "" } button .c.nodr.5 -text 5 -width 2 -background LemonChiffon -command { set nodenr 5 set nodeip "" set ttydev "" } button .c.nodr.6 -text 6 -width 2 -background LemonChiffon -command { set nodenr 6 set nodeip "" set ttydev "" } button .c.nodr.7 -text 7 -width 2 -background LemonChiffon -command { set nodenr 7 set nodeip "" set ttydev "" } button .c.nodr.8 -text 8 -width 2 -background LemonChiffon -command { set nodenr 8 set nodeip "" set ttydev "" } button .c.nodr.9 -text 9 -width 2 -background LemonChiffon -command { set nodenr 9 set nodeip "" set ttydev "" } button .c.nodr.10 -text 10 -width 2 -background LemonChiffon -command { set nodenr 10 set nodeip "" set ttydev "" } button .c.nodr.11 -text 11 -width 2 -background LemonChiffon -command { set nodenr 11 set nodeip "" set ttydev "" } button .c.nodr.12 -text 12 -width 2 -background LemonChiffon -command { set nodenr 12 set nodeip "" set ttydev "" } button .c.nodr.13 -text 13 -width 2 -background LemonChiffon -command { set nodenr 13 set nodeip "" set ttydev "" } button .c.nodr.14 -text 14 -width 2 -background LemonChiffon -command { set nodenr 14 set nodeip "" set ttydev "" } button .c.nodr.15 -text 15 -width 2 -background LemonChiffon -command { set nodenr 15 set nodeip "" set ttydev "" } button .c.nodr.16 -text 16 -width 2 -background LemonChiffon -command { set nodenr 16 set nodeip "" set ttydev "" } button .c.nodr.17 -text 17 -width 2 -background LemonChiffon -command { set nodenr 17 set nodeip "" set ttydev "" } button .c.nodr.18 -text 18 -width 2 -background LemonChiffon -command { set nodenr 18 set nodeip "" set ttydev "" } button .c.nodr.19 -text 19 -width 2 -background LemonChiffon -command { set nodenr 19 set nodeip "" set ttydev "" } button .c.nodr.20 -text 20 -width 2 -background LemonChiffon -command { set nodenr 20 set nodeip "" set ttydev "" } button .c.nodr.21 -text 21 -width 2 -background LemonChiffon -command { set nodenr 21 set nodeip "" set ttydev "" } button .c.nodr.22 -text 22 -width 2 -background LemonChiffon -command { set nodenr 22 set nodeip "" set ttydev "" } button .c.nodr.23 -text 23 -width 2 -background LemonChiffon -command { set nodenr 23 set nodeip "" set ttydev "" } button .c.nodr.24 -text 24 -width 2 -background LemonChiffon -command { set nodenr 24 set nodeip "" set ttydev "" } button .c.nodr.25 -text 25 -width 2 -background LemonChiffon -command { set nodenr 25 set nodeip "" set ttydev "" } button .c.nodr.26 -text 26 -width 2 -background LemonChiffon -command { set nodenr 26 set nodeip "" set ttydev "" } button .c.nodr.27 -text 27 -width 2 -background LemonChiffon -command { set nodenr 27 set nodeip "" set ttydev "" } button .c.nodr.28 -text 28 -width 2 -background LemonChiffon -command { set nodenr 28 set nodeip "" set ttydev "" } button .c.nodr.29 -text 29 -width 2 -background LemonChiffon -command { set nodenr 29 set nodeip "" set ttydev "" } button .c.nodr.30 -text 30 -width 2 -background LemonChiffon -command { set nodenr 30 set nodeip "" set ttydev "" } button .c.nodr.31 -text 31 -width 2 -background LemonChiffon -command { set nodenr 31 set nodeip "" set ttydev "" } button .c.nodr.32 -text 32 -width 2 -background LemonChiffon -command { set nodenr 32 set nodeip "" set ttydev "" } #........................................................................ #proc node #........................................................................ proc node {} { global last_frame last_frame2 nodeip run set run "Configure and/or Select Node" .c.prog configure -text $run if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.nod -column 9 -row 10 -padx 30 -rowspan 8 grid .c.nodr -column 9 -row 2 -padx 30 -rowspan 8 set last_frame ".c.nod" set last_frame2 ".c.nodr" grid .c.nod.nummer -column 0 -row 0 grid .c.nod.nodenr -column 1 -row 0 grid .c.nod.descl -column 0 -row 1 grid .c.nod.desc -column 1 -row 1 grid .c.nod.ipnr -column 0 -row 2 grid .c.nod.ip -column 1 -row 2 grid .c.nod.ipport -column 0 -row 3 grid .c.nod.port -column 1 -row 3 grid .c.nod.tty -column 0 -row 4 grid .c.nod.ttydev -column 1 -row 4 grid .c.nod.sw -column 0 -row 5 grid .c.nod.nodesw -column 1 -row 5 grid .c.nod.pin -column 0 -row 6 grid .c.nod.nodepin -column 1 -row 6 grid .c.nod.pin2 -column 0 -row 7 grid .c.nod.nodepin2 -column 1 -row 7 grid .c.nod.chan -column 1 -row 8 grid .c.nod.ok -column 1 -row 9 grid .c.nod.ok2 -column 2 -row 9 grid .c.nod.ok3 -column 0 -row 9 grid .c.nodr.1 -column 0 -row 0 grid .c.nodr.2 -column 1 -row 0 grid .c.nodr.3 -column 2 -row 0 grid .c.nodr.4 -column 3 -row 0 grid .c.nodr.5 -column 4 -row 0 grid .c.nodr.6 -column 5 -row 0 grid .c.nodr.7 -column 6 -row 0 grid .c.nodr.8 -column 7 -row 0 grid .c.nodr.9 -column 0 -row 1 grid .c.nodr.10 -column 1 -row 1 grid .c.nodr.11 -column 2 -row 1 grid .c.nodr.12 -column 3 -row 1 grid .c.nodr.13 -column 4 -row 1 grid .c.nodr.14 -column 5 -row 1 grid .c.nodr.15 -column 6 -row 1 grid .c.nodr.16 -column 7 -row 1 grid .c.nodr.17 -column 0 -row 2 grid .c.nodr.18 -column 1 -row 2 grid .c.nodr.19 -column 2 -row 2 grid .c.nodr.20 -column 3 -row 2 grid .c.nodr.21 -column 4 -row 2 grid .c.nodr.22 -column 5 -row 2 grid .c.nodr.23 -column 6 -row 2 grid .c.nodr.24 -column 7 -row 2 grid .c.nodr.25 -column 0 -row 3 grid .c.nodr.26 -column 1 -row 3 grid .c.nodr.27 -column 2 -row 3 grid .c.nodr.28 -column 3 -row 3 grid .c.nodr.29 -column 4 -row 3 grid .c.nodr.30 -column 5 -row 3 grid .c.nodr.31 -column 6 -row 3 grid .c.nodr.32 -column 7 -row 3 } proc node1 {} { global nodenr set nodenr 1 } #========================================================================== #==== select programm ======= #========================================================================== #frame .c.sp frame .c.sp button .c.sp.com -text commandline -width 15 -command {com} button .c.sp.weg -text weg -width 15 -command weg button .c.sp.aan -text aan -width 15 -command aan button .c.sp.b3 -text b3 -width 15 -command B3 button .c.sp.test -text test -width 15 -command PD0 proc progsel {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} set last_frame ".c.sp" set last_frame2 "" grid .c.sp -column 9 -row 2 -rowspan 5 grid .c.sp.com -column 0 -row 0 grid .c.sp.weg -column 0 -row 1 grid .c.sp.aan -column 0 -row 2 grid .c.sp.b3 -column 0 -row 3 grid .c.sp.test -column 0 -row 4 } #=========================================================================== #==== command line =============================================== #=========================================================================== # vars command line set inn1 "" set inn2 "" set inn3 "" set inn4 "" set inn5 "" set inn6 "" set inn7 "" set inn8 "" set inn9 "" set inn10 "" set inn11 "" set inn12 "" set inn13 "" set inn14 "" set inn15 "" set inn16 "" set inn17 "" set inn18 "" set inn19 "" set inn20 "" set inn21 "" set inn22 "" set inn23 "" set inn24 "" set inn25 "" set inn26 "" set inn27 "" set inn28 "" #set chan "" set ingang "version" set run "" label .c.chan -background white label .c.prog -text "PROG: $run" -background PeachPuff -width 60 frame .c.com label .c.com.inn1 -text $inn1 -background white -width 25 label .c.com.inn2 -text $inn2 -background white -width 25 label .c.com.inn3 -text $inn3 -background white -width 25 label .c.com.inn4 -text $inn4 -background white -width 25 label .c.com.inn5 -text $inn5 -background white -width 25 label .c.com.inn6 -text $inn6 -background white -width 25 label .c.com.inn7 -text $inn7 -background white -width 25 label .c.com.inn8 -text $inn8 -background white -width 25 label .c.com.inn9 -text $inn9 -background white -width 25 label .c.com.inn10 -text $inn10 -background white -width 25 label .c.com.inn11 -text $inn11 -background white -width 25 label .c.com.inn12 -text $inn12 -background white -width 25 label .c.com.inn13 -text $inn13 -background white -width 25 label .c.com.inn14 -text $inn14 -background white -width 25 label .c.com.inn15 -text $inn15 -background white -width 25 label .c.com.inn16 -text $inn16 -background white -width 25 label .c.com.inn17 -text $inn17 -background white -width 25 label .c.com.inn18 -text $inn18 -background white -width 25 label .c.com.inn19 -text $inn19 -background white -width 25 label .c.com.inn20 -text $inn20 -background white -width 25 label .c.com.inn21 -text $inn21 -background white -width 25 label .c.com.inn22 -text $inn22 -background white -width 25 label .c.com.inn23 -text $inn23 -background white -width 25 label .c.com.inn24 -text $inn24 -background white -width 25 label .c.com.inn25 -text $inn25 -background white -width 25 label .c.com.inn26 -text $inn26 -background white -width 25 label .c.com.inn27 -text $inn27 -background white -width 25 label .c.com.inn28 -text $inn28 -background white -width 25 entry .c.com.ing -textvariable ingang -background white button .c.com.upd -text Enter -background honeydew -command { puts $chan $ingang flush $chan set inn "start" for {set y 1} {$y < 29} {incr y} { if {$inn != "" } {after 25} gets $chan inn .c.com.inn$y configure -text $inn set inn$y $inn } } #.................................................................................. # proc com #.................................................................................. proc com {} { global chan last_frame last_frame2 run set run "Command Line" .c.prog configure -text $run if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} set last_frame .c.com set last_frame2 "" bind .c.com.ing ".c.com.upd invoke" grid .c.com -column 9 -row 2 -rowspan 18 -padx 20 grid .c.com.ing -column 9 -row 20 grid .c.com.upd -column 9 -row 21 grid .c.com.inn1 -column 9 -row 2 grid .c.com.inn2 -column 9 -row 3 grid .c.com.inn3 -column 9 -row 4 grid .c.com.inn4 -column 9 -row 5 grid .c.com.inn5 -column 9 -row 6 grid .c.com.inn6 -column 9 -row 7 grid .c.com.inn7 -column 9 -row 8 grid .c.com.inn8 -column 9 -row 9 grid .c.com.inn9 -column 9 -row 10 grid .c.com.inn10 -column 9 -row 11 grid .c.com.inn11 -column 9 -row 12 grid .c.com.inn12 -column 9 -row 13 grid .c.com.inn13 -column 9 -row 14 grid .c.com.inn14 -column 9 -row 15 grid .c.com.inn15 -column 11 -row 2 grid .c.com.inn16 -column 11 -row 3 grid .c.com.inn17 -column 11 -row 4 grid .c.com.inn18 -column 11 -row 5 grid .c.com.inn19 -column 11 -row 6 grid .c.com.inn20 -column 11 -row 7 grid .c.com.inn21 -column 11 -row 8 grid .c.com.inn22 -column 11 -row 9 grid .c.com.inn23 -column 11 -row 10 grid .c.com.inn24 -column 11 -row 11 grid .c.com.inn25 -column 11 -row 12 grid .c.com.inn26 -column 11 -row 13 grid .c.com.inn27 -column 11 -row 14 grid .c.com.inn28 -column 11 -row 15 } grid .c.chan -column 0 -row 21 -columnspan 6 -pady 20 grid .c.prog -column 9 -row 21 -columnspan 6 -pady 20 #============================================================================ #==== testing area probing constructions ================== #============================================================================ #------------------------------------------------------------------------- #ADC0 #------------------------------------------------------------------------- set adc0 3.543 set z "0.5*4/2" set y [expr $adc0*$z] set xx "%5.3f V" set adc0__ [format $xx $y] #------------------------------------------------------------------------- #B0 #------------------------------------------------------------------------- .c.b0 configure -text $b0 -background $b0_ proc aan {} { global b0 grid forget .c.b0 grid forget .c.b0 if { $b0 == "255.255.255.255" } {set y 1} {set y 0} if { $y == 1} { set b0 " IN " } if { $y == 0} { set b0 "255.255.255.255" } .c.b0 configure -text $b0 grid .c.b0 -column 0 -row 2 ;grid .c.b0 -column 0 -row 2 update } #-------------------------------------------------------------------------- #B1 #-------------------------------------------------------------------------- proc weg {} { grid forget .c.b0 grid forget .c.b0 set xxx 0 set b0 " IN " if {$xxx == 1} {grid .c.b0 -column 0 -row 2 ; grid .c.b0 -column 0 -row 2} update } #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # B3 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #......................................................................... # frame #......................................................................... set acn01 1 frame .c.fb3 -borderwidth 5 -relief sunken button .c.fb3.acn00 -command fB3_2 label .c.fb3.acn01 button .c.fb3.end -text STOP -command end #.......................................................................... # procedure #.......................................................................... proc B3 {} { global acn01 firstrun last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} set last_frame ".c.fb3" set acnn 0 grid .c.fb3 -column 9 -row 2 -rowspan 16 if {$acn01 == 1} {set acn01 0 ; set aktie 1} {set acn01 1 ; set aktie 0} if {$aktie == 1 } {set kleur yellow} {set kleur blue} .c.fb3.acn01 configure -text "$acn01$aktie" -background $kleur grid .c.fb3 -column 9 -row 2 -padx 30 -rowspan 16 grid .c.fb3.acn01 -column 0 -row 1 grid .c.fb3.acn00 -column 0 -row 1 grid .c.fb3.end -column 1 -row 1 } #........................................................................... #intern proc #........................................................................... proc fB3_2 {} { global acn01 aktie if {$acn01 == 1} {set acn01 0 ; set aktie 1} {set acn01 1 ; set aktie 0} if {$aktie == 1 } {set kleur yellow} {set kleur blue} .c.fb3.acn01 configure -text "$acn01$aktie" -background $kleur } #............................................................................ #intern B3 #............................................................................ proc end {} { grid forget .c.fb3 } #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #PD0 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #............................................................................. #frame #............................................................................. frame .c.fpd0 -borderwidth 5 -relief sunken button .c.fpd0.set -text "STOP" -command {pd0stop} -background yellow label .c.fpd0.iets -text "label0" -background yellow label .c.fpd0.iets2 -text "label1" label .c.fpd0.iets3 -text "label2" button .c.fpd0.nr2 -text nr2 -command nr2 .c.fpd0.nr2 configure -background red -width 15 -relief solid set texte "nothing doing" entry .c.fpd0.nr3 -background LemonChiffon -textvariable texte button .c.fpd0.nr4 button .c.fpd0.nr5 label .c.fpd0.kop -text "=== configuration of port PA0 ===" #............................................................................. #procedure #............................................................................. proc nr2 {} { global texte .c.fpd0.kop configure -text $texte } proc PD0 {} { global last_frame last_frame2 if {$last_frame != ""} {grid forget $last_frame} if {$last_frame2 != ""} {grid forget $last_frame2} grid .c.fpd0 -column 9 -row 2 -padx 30 -rowspan 16 set last_frame ".c.fpd0" grid .c.fpd0.set -column 1 -row 1 grid .c.fpd0.kop -column 1 -row 0 -columnspan 6 grid .c.fpd0.iets -column 1 -row 2 grid .c.fpd0.iets2 -column 1 -row 3 grid .c.fpd0.iets3 -column 1 -row 4 grid .c.fpd0.nr2 -column 1 -row 5 grid .c.fpd0.nr3 -column 2 -row 3 grid .c.fpd0.nr4 -column 2 -row 2 grid .c.fpd0.nr5 -column 3 -row 4 } #............................................................................. # intern proc PD0 -- quit PD0 frame #............................................................................. proc pd0stop {} { grid forget .c.fpd0 }