Changeset 74
- Timestamp:
- Nov 26, 2009, 12:15:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/UserInterface.tcl
r73 r74 61 61 my instvar data xvec yvec 62 62 63 dict set data none {} 64 dict set data uwt1 {} 65 dict set data uwt2 {} 66 dict set data uwt3 {} 67 # dict set data sum8 {} 63 set data {} 68 64 69 65 $yvec set {} … … 73 69 74 70 OscDisplay instproc start {} { 75 my instvar config 76 71 my instvar config trig_mux disp_mux 72 73 set trig_mux 2 74 set disp_mux 2 75 77 76 trace add variable [myvar auto] write [myproc auto_update] 78 77 trace add variable [myvar thrs] write [myproc thrs_update] 79 trace add variable [myvar fltr_val] write [myproc fltr_val_update] 80 81 ${config}.thrs_check deselect 82 ${config}.thrs_field set 10 83 ${config}.none select 78 trace add variable [myvar thrs_val] write [myproc thrs_val_update] 79 trace add variable [myvar disp_val] write [myproc disp_val_update] 80 trace add variable [myvar trig_val] write [myproc trig_val_update] 81 82 ${config}.auto_check select 83 ${config}.thrs_check select 84 ${config}.thrs_field set 60 85 ${config}.disp_uwt2 select 86 ${config}.trig_uwt2 select 84 87 } 85 88 … … 89 92 my instvar number master 90 93 my instvar data xvec yvec 91 my instvar config auto thrs thrs_val fltr_val94 my instvar config auto thrs thrs_val disp_val trig_val 92 95 93 96 my set restart_command [usb::convert 0001000${number}00000000] … … 114 117 frame ${config}.spc2 -width 10 -height 10 115 118 116 label ${config}.fltr -text {low-pass filter} 117 radiobutton ${config}.none -text none -variable [myvar fltr_val] -value none 118 radiobutton ${config}.uwt1 -text uwt1 -variable [myvar fltr_val] -value uwt1 119 radiobutton ${config}.uwt2 -text uwt2 -variable [myvar fltr_val] -value uwt2 120 radiobutton ${config}.uwt3 -text uwt3 -variable [myvar fltr_val] -value uwt3 121 # radiobutton ${config}.sum8 -text sum8 -variable [myvar fltr_val] -value sum8 119 label ${config}.disp -text {display input} 120 radiobutton ${config}.disp_data -text {raw data} -variable [myvar disp_val] -value data 121 radiobutton ${config}.disp_uwt1 -text {filter 1} -variable [myvar disp_val] -value uwt1 122 radiobutton ${config}.disp_uwt2 -text {filter 2} -variable [myvar disp_val] -value uwt2 123 radiobutton ${config}.disp_uwt3 -text {filter 3} -variable [myvar disp_val] -value uwt3 124 radiobutton ${config}.disp_base -text {baseline} -variable [myvar disp_val] -value base 125 # radiobutton ${config}.disp_sum8 -text {sum of 8} -variable [myvar disp_val] -value sum8 122 126 123 127 frame ${config}.spc3 -width 10 -height 10 128 129 label ${config}.trig -text {trigger input} 130 radiobutton ${config}.trig_data -text {raw data} -variable [myvar trig_val] -value data 131 radiobutton ${config}.trig_uwt1 -text {filter 1} -variable [myvar trig_val] -value uwt1 132 radiobutton ${config}.trig_uwt2 -text {filter 2} -variable [myvar trig_val] -value uwt2 133 radiobutton ${config}.trig_uwt3 -text {filter 3} -variable [myvar trig_val] -value uwt3 134 radiobutton ${config}.trig_base -text {baseline} -variable [myvar trig_val] -value base 135 # radiobutton ${config}.trig_sum8 -text {sum of 8} -variable [myvar trig_val] -value sum8 136 137 frame ${config}.spc4 -width 10 -height 10 124 138 125 139 button ${config}.acquire -text Acquire \ … … 135 149 grid ${config}.thrs_field -sticky ew -pady 1 -padx 5 136 150 grid ${config}.spc2 137 grid ${config}.fltr -sticky w -pady 1 -padx 3 138 grid ${config}.none -sticky w 139 grid ${config}.uwt1 -sticky w 140 grid ${config}.uwt2 -sticky w 141 grid ${config}.uwt3 -sticky w 142 # grid ${config}.sum8 -sticky w 151 grid ${config}.disp -sticky w -pady 1 -padx 3 152 grid ${config}.disp_data -sticky w 153 grid ${config}.disp_uwt1 -sticky w 154 grid ${config}.disp_uwt2 -sticky w 155 grid ${config}.disp_uwt3 -sticky w 156 grid ${config}.disp_base -sticky w 157 # grid ${config}.disp_sum8 -sticky w 143 158 grid ${config}.spc3 159 grid ${config}.trig -sticky w -pady 1 -padx 3 160 grid ${config}.trig_data -sticky w 161 grid ${config}.trig_uwt1 -sticky w 162 grid ${config}.trig_uwt2 -sticky w 163 grid ${config}.trig_uwt3 -sticky w 164 grid ${config}.trig_base -sticky w 165 # grid ${config}.disp_sum8 -sticky w 166 grid ${config}.spc4 144 167 grid ${config}.acquire -sticky ew -pady 3 -padx 5 145 168 grid ${config}.restart -sticky ew -pady 3 -padx 5 … … 161 184 162 185 OscDisplay instproc auto_update args { 163 my instvar auto after_handle186 my instvar config auto after_handle 164 187 165 188 if {$auto} { … … 182 205 183 206 OscDisplay instproc thrs_update args { 184 my instvar config thrs 207 my instvar config number thrs thrs_val 208 209 set val_addr [format %04x [expr {17 + ${number}}]] 210 185 211 if {$thrs} { 186 212 ${config}.thrs_field configure -state normal 213 my thrs_val_update 187 214 } else { 188 215 ${config}.thrs_field configure -state disabled 189 } 190 } 191 192 # ------------------------------------------------------------------------- 193 194 OscDisplay instproc fltr_val_update args { 195 my instvar yvec data fltr_val 196 $yvec set [dict get $data $fltr_val] 216 my send_data [usb::convert ${val_addr}000000000000] 217 } 218 } 219 220 # ------------------------------------------------------------------------- 221 222 OscDisplay instproc thrs_val_update args { 223 my instvar config number thrs_val 224 225 set val_addr [format %04x [expr {17 + ${number}}]] 226 set value [format %04x $thrs_val] 227 228 my send_data [usb::convert ${val_addr}${value}00000000] 229 } 230 231 # ------------------------------------------------------------------------- 232 233 OscDisplay instproc mux {} { 234 my instvar trig_mux disp_mux 235 236 format {00%x%x} $trig_mux $disp_mux 237 } 238 239 # ------------------------------------------------------------------------ 240 241 OscDisplay instproc disp_val_update args { 242 my instvar number disp_val disp_mux 243 244 set mux_addr [format %04x [expr {20 + ${number}}]] 245 246 switch -- $disp_val { 247 data { 248 set disp_mux 0 249 my send_data [usb::convert ${mux_addr}[my mux]00000000] 250 } 251 uwt1 { 252 set disp_mux 1 253 my send_data [usb::convert ${mux_addr}[my mux]00000000] 254 } 255 uwt2 { 256 set disp_mux 2 257 my send_data [usb::convert ${mux_addr}[my mux]00000000] 258 } 259 uwt3 { 260 set disp_mux 3 261 my send_data [usb::convert ${mux_addr}[my mux]00000000] 262 } 263 base { 264 set disp_mux 4 265 my send_data [usb::convert ${mux_addr}[my mux]00000000] 266 } 267 } 268 } 269 270 # ------------------------------------------------------------------------ 271 272 OscDisplay instproc trig_val_update args { 273 my instvar number trig_val trig_mux 274 275 set mux_addr [format %04x [expr {20 + ${number}}]] 276 277 switch -- $trig_val { 278 data { 279 set trig_mux 0 280 my send_data [usb::convert ${mux_addr}[my mux]00000000] 281 } 282 uwt1 { 283 set trig_mux 1 284 my send_data [usb::convert ${mux_addr}[my mux]00000000] 285 } 286 uwt2 { 287 set trig_mux 2 288 my send_data [usb::convert ${mux_addr}[my mux]00000000] 289 } 290 uwt3 { 291 set trig_mux 3 292 my send_data [usb::convert ${mux_addr}[my mux]00000000] 293 } 294 base { 295 set trig_mux 4 296 my send_data [usb::convert ${mux_addr}[my mux]00000000] 297 } 298 } 197 299 } 198 300 … … 246 348 OscDisplay instproc acquire {} { 247 349 global usb_handle 248 my instvar xvec yvec data fltr_val350 my instvar xvec yvec data 249 351 my instvar acquire_command 250 352 … … 258 360 } 259 361 260 dict set data none $usb_data 261 dict set data uwt1 [lindex [uwt 1 $usb_data] 1] 262 dict set data uwt2 [lindex [uwt 2 $usb_data] 1] 263 dict set data uwt3 [lindex [uwt 3 $usb_data] 1] 264 # dict set data sum8 [sum8 $usb_data] 265 266 $yvec set [dict get $data $fltr_val] 362 set data $usb_data 363 364 $yvec set $usb_data 267 365 } 268 366 … … 313 411 my instvar data xvec yvec 314 412 315 dict set data none {} 316 dict set data uwt1 {} 317 dict set data uwt2 {} 318 dict set data uwt3 {} 319 # dict set data sum8 {} 413 set data {} 320 414 321 415 $yvec set {} … … 325 419 326 420 HstDisplay instproc start {} { 327 my instvar config peak_mux base_mux 328 421 my instvar config base_mux peak_mux 422 423 set base_mux 0 329 424 set peak_mux 1 330 set base_mux 0331 425 332 426 trace add variable [myvar auto] write [myproc auto_update] 333 427 trace add variable [myvar peak] write [myproc peak_update] 334 428 trace add variable [myvar thrs] write [myproc thrs_update] 429 trace add variable [myvar thrs_val] write [myproc thrs_val_update] 335 430 trace add variable [myvar base] write [myproc base_update] 336 431 trace add variable [myvar base_typ] write [myproc base_typ_update] … … 446 541 447 542 HstDisplay instproc mux {} { 448 my instvar peak_mux base_mux449 450 format { %x%x%x%x} $base_mux $peak_mux 0 0543 my instvar base_mux peak_mux 544 545 format {00%x%x} $base_mux $peak_mux 451 546 } 452 547 … … 456 551 my instvar number peak peak_mux 457 552 458 set mux_addr [format %04x [expr {2 0+ ${number}}]]553 set mux_addr [format %04x [expr {23 + ${number}}]] 459 554 460 555 if {$peak} { … … 477 572 if {$thrs} { 478 573 ${config}.thrs_field configure -state normal 479 my send_data [usb::convert ${val_addr}${value}00000000]574 my thrs_val_update 480 575 } else { 481 576 ${config}.thrs_field configure -state disabled … … 492 587 set value [format %04x $thrs_val] 493 588 494 ${config}.base_field configure -state normal495 589 my send_data [usb::convert ${val_addr}${value}00000000] 496 590 } … … 501 595 my instvar config number base base_val base_mux 502 596 503 set mux_addr [format %04x [expr {2 0+ ${number}}]]597 set mux_addr [format %04x [expr {23 + ${number}}]] 504 598 set val_addr [format %04x [expr {11 + ${number}}]] 505 599 … … 522 616 my instvar config number base_typ base_val base_mux 523 617 524 set mux_addr [format %04x [expr {2 0+ ${number}}]]618 set mux_addr [format %04x [expr {23 + ${number}}]] 525 619 set val_addr [format %04x [expr {11 + ${number}}]] 526 620 set value [format %04x $base_val]
Note:
See TracChangeset
for help on using the changeset viewer.