source: trunk/3DEES/UserInterface.tcl@ 199

Last change on this file since 199 was 188, checked in by demin, 11 years ago

fix bin numbers

File size: 46.7 KB
RevLine 
[73]1package require XOTcl
2
3package require BLT
4package require swt
5package require usb
6
[85]7package require zlib
[73]8
[85]9wm minsize . 1000 700
10
[73]11namespace eval ::mca {
12 namespace import ::xotcl::*
13
14 namespace import ::blt::vector
15 namespace import ::blt::graph
16 namespace import ::blt::tabnotebook
17
[143]18# -------------------------------------------------------------------------
19
20 variable oscCodes
21 array set oscCodes {
22 1 {Channel 1}
23 2 {Channel 2}
24 3 {Channel 3}
25 4 {Channel 4}
26 5 {Channel 5}
27 6 {Trigger}
28 }
29
30# -------------------------------------------------------------------------
31
32 variable adcCodes
33 array set adcCodes {
[181]34 1 {S1_F}
35 2 {S1_S}
36 3 {S2}
37 4 {D1}
38 5 {D2}
39 6 {D3}
[143]40 }
41
42# -------------------------------------------------------------------------
43
[181]44 variable cfgCodes
45 array set cfgCodes {
46 {1_0} 0
47 {1_1} 6
[184]48 {1_2} 7
49 {1_3} 8
[181]50 {2_0} 1
[184]51 {2_1} 9
52 {2_2} 10
53 {2_3} 11
[181]54 {3_0} 2
[184]55 {3_1} 12
56 {3_2} 13
57 {3_3} 14
[186]58 {3_4} 15
[181]59 {4_0} 3
[186]60 {4_1} 16
61 {4_2} 17
62 {4_3} 18
63 {4_4} 19
[181]64 {5_0} 4
[186]65 {5_1} 20
66 {5_2} 21
67 {5_3} 22
68 {5_4} 23
[181]69 {6_0} 5
[186]70 {6_1} 24
71 {6_2} 25
72 {6_3} 26
73 {6_4} 27
[181]74 }
75# -------------------------------------------------------------------------
76
77 variable cfgThrs
78 array set cfgThrs {
[184]79 0 8
80 6 150
81 7 200
82 8 3000
83 1 8
84 9 150
85 10 200
86 11 3000
87 2 10
[186]88 12 10
89 13 31
90 14 52
91 15 79
92 3 10
93 16 60
94 17 135
95 18 171
96 19 233
97 4 10
98 20 249
99 21 348
100 22 495
101 23 693
102 5 10
103 24 505
104 25 606
105 26 707
106 27 808
[181]107 }
108
[186]109
[181]110# -------------------------------------------------------------------------
111
[143]112 variable inpCodes
113 array set inpCodes {
[183]114 0 {rs}
115 1 {cs}
116 2 {av}
117 3 {af}
118 4 {bn}
[186]119 5 {bf}
[143]120 }
121
122# -------------------------------------------------------------------------
123
124 proc validate {max size value} {
[85]125 if {![regexp {^[0-9]*$} $value]} {
[73]126 return 0
[143]127 } elseif {[regexp {^0[0-9]+$} $value]} {
128 return 0
[85]129 } elseif {$value > $max} {
[73]130 return 0
[143]131 } elseif {[string length $value] > $size} {
[73]132 return 0
133 } else {
134 return 1
135 }
136 }
137
138# -------------------------------------------------------------------------
139
[143]140 proc doublevalidate {max value} {
141 if {![regexp {^[0-9]{0,2}\.?[0-9]{0,3}$} $value]} {
142 return 0
143 } elseif {[regexp {^0[0-9]+$} $value]} {
144 return 0
145 } elseif {$value > $max} {
146 return 0
147 } else {
148 return 1
149 }
150 }
[85]151
152# -------------------------------------------------------------------------
153
[143]154 proc legendLabel {master row key title} {
155 label ${master}.${key}_label -anchor w -text ${title}
156 label ${master}.${key}_value -width 10 -anchor e -text {}
[85]157
[143]158 grid ${master}.${key}_label -row ${row} -column 1 -sticky w
159 grid ${master}.${key}_value -row ${row} -column 2 -sticky ew
160 }
161
162# -------------------------------------------------------------------------
163
164 proc legendButton {master row key title var bg {fg black}} {
165 checkbutton ${master}.${key}_check -variable $var
166 label ${master}.${key}_label -anchor w -text ${title} -bg ${bg} -fg $fg
167 label ${master}.${key}_value -width 10 -anchor e -text {} -bg ${bg} -fg $fg
168
169 grid ${master}.${key}_check -row ${row} -column 0 -sticky w
170 grid ${master}.${key}_label -row ${row} -column 1 -sticky w
171 grid ${master}.${key}_value -row ${row} -column 2 -sticky ew
172 }
173
174# -------------------------------------------------------------------------
175
176 Class UsbController
177
178# -------------------------------------------------------------------------
179
[180]180 UsbController instproc init {} {
181
182 my set ignore false
183
184 next
185 }
186
187# -------------------------------------------------------------------------
188
[143]189 UsbController instproc usbConnect {} {
[180]190 my instvar handle ignore
[143]191
192 puts usbConnect
193
194 if {[my exists handle]} {
195 $handle disconnect
196 unset handle
[85]197 }
[180]198 if {!$ignore} {
199 while {[catch {usb::connect 0x09FB 0x6001 1 1 0} result]} {
200 set answer [tk_messageBox -icon error -type abortretryignore \
201 -message {Cannot access USB device} -detail $result]
202 if {[string equal $answer abort]} exit
203 if {[string equal $answer ignore]} {
204 set ignore true
205 return
206 }
207 }
[143]208
[180]209 set handle $result
[143]210
[180]211 }
[85]212 }
213
214# -------------------------------------------------------------------------
215
[143]216 UsbController instproc usbHandle {} {
[180]217 my instvar handle ignore
[85]218
[143]219 if {[my exists handle]} {
220 return $handle
[180]221 } elseif {!$ignore} {
[143]222 my usbConnect
223 }
224 }
[85]225
[143]226# -------------------------------------------------------------------------
227
228 UsbController instproc usbCmd {command} {
229 set code [catch {[my usbHandle] writeRaw [usb::convert $command]} result]
230 switch -- $code {
231 1 {
232# puts $result
233 my usbConnect
234 }
[85]235 }
236
237 }
238
239# -------------------------------------------------------------------------
240
[143]241 UsbController instproc usbCmdReadRaw {command size data} {
242 my usbCmd $command
[85]243
[143]244 set code [catch {[my usbHandle] readRaw $size} result]
245 switch -- $code {
246 0 {
247 set $data $result
248 }
249 1 {
250# puts $result
251 my usbConnect
252 }
253 5 {
254# puts Busy
255 }
256 }
257 }
258
259# -------------------------------------------------------------------------
260
261 UsbController instproc usbCmdReadRaw {command size data} {
[85]262 my usbCmd $command
263
[143]264 set code [catch {[my usbHandle] readRaw $size} result]
265 switch -- $code {
266 0 {
267 set $data $result
268 }
269 1 {
270# puts $result
271 my usbConnect
272 }
273 5 {
274# puts Busy
275 }
[85]276 }
[143]277 }
[85]278
[143]279# -------------------------------------------------------------------------
280
281 UsbController instproc usbCmdReadHex {command width size data} {
282 my usbCmd $command
283
284 set code [catch {[my usbHandle] readHex $width $size} result]
285 switch -- $code {
286 0 {
287 set $data $result
288 }
289 1 {
290# puts $result
291 my usbConnect
292 }
293 5 {
294# puts Busy
295 }
296 }
[85]297 }
298
299# -------------------------------------------------------------------------
300
[180]301 Class CfgDisplay -parameter {
[77]302 {master}
[143]303 {controller}
[77]304 }
305
306# -------------------------------------------------------------------------
307
[180]308 CfgDisplay instproc init {} {
[77]309
310 my setup
311
312 next
313 }
314
315# -------------------------------------------------------------------------
316
[180]317 CfgDisplay instproc destroy {} {
[77]318 next
319 }
320
321# -------------------------------------------------------------------------
322
[180]323 CfgDisplay instproc start {} {
324 variable adcCodes
[181]325 variable cfgThrs
[77]326
[180]327 foreach {ch id} [array get adcCodes] {
[181]328 my set delay($ch) 32
329 my set decay($ch) 1000
[180]330 }
331
[181]332 foreach {i value} [array get cfgThrs] {
333 my set thrs($i) $value
[180]334 }
335
[181]336 trace add variable [myvar decay] write [myproc decay_update]
337 trace add variable [myvar delay] write [myproc delay_update]
338 trace add variable [myvar thrs] write [myproc thrs_update]
[186]339
[181]340 my delay_update
341 my thrs_update
[77]342 }
343
344# -------------------------------------------------------------------------
345
[180]346 CfgDisplay instproc setup {} {
347 variable adcCodes
[181]348 variable cfgCodes
[77]349 my instvar number master
350 my instvar config
351
[180]352 set thrs [frame ${master}.thrs]
[186]353 set bins [frame ${master}.bins]
[180]354 set clip [frame ${master}.clip]
[77]355
[180]356 set config(thrs) [labelframe ${thrs}.frame -borderwidth 1 -relief sunken -text {Thresholds}]
[77]357
[180]358 set column 0
[186]359 foreach {input} [list "ADC" "e thrs min" "e thrs max" "p thrs min" "p thrs max"] {
[180]360 label ${config(thrs)}.label_${column} -text "${input}"
361 grid ${config(thrs)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7
362 incr column
363 }
[77]364
[186]365 foreach {ch id} [array get adcCodes {[1-2]}] {
[181]366 label ${config(thrs)}.chan_${ch} -text "${id} "
[180]367 grid ${config(thrs)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7
[184]368 foreach {num} [list 0 1 2 3] {
[180]369 set column [expr {$num + 1}]
[181]370 set value $cfgCodes(${ch}_${num})
[180]371 spinbox ${config(thrs)}.thrs_${value} -from 0 -to 4095 \
372 -increment 10 -width 10 -textvariable [myvar thrs($value)] \
373 -validate all -vcmd {::mca::validate 4095 4 %P}
374 grid ${config(thrs)}.thrs_${value} -row ${ch} -column ${column} -sticky w -padx 5 -pady 7
375 }
376 }
[77]377
[180]378 grid $config(thrs) -row 0 -column 0 -sticky news -padx 10
[77]379
[186]380 set config(bins) [labelframe ${bins}.frame -borderwidth 1 -relief sunken -text {Bins}]
381
382 set column 0
383 foreach {input} [list "ADC" "thrs 0" "thrs 1" "thrs 2" "thrs 3" "thrs 4"] {
384 label ${config(bins)}.label_${column} -text "${input}"
385 grid ${config(bins)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7
386 incr column
387 }
388
389 foreach {ch id} [array get adcCodes {[3-6]}] {
390 label ${config(bins)}.chan_${ch} -text "${id} "
391 grid ${config(bins)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7
392 foreach {num} [list 0 1 2 3 4] {
393 set column [expr {$num + 1}]
394 set value $cfgCodes(${ch}_${num})
395 spinbox ${config(bins)}.bins_${value} -from 0 -to 4095 \
396 -increment 10 -width 10 -textvariable [myvar thrs($value)] \
397 -validate all -vcmd {::mca::validate 4095 4 %P}
398 grid ${config(bins)}.bins_${value} -row ${ch} -column ${column} -sticky w -padx 5 -pady 7
399 }
400 }
401
402 grid $config(bins) -row 0 -column 0 -sticky news -padx 10
403
[180]404 set config(clip) [labelframe ${clip}.frame -borderwidth 1 -relief sunken -text {Signal clipping}]
[77]405
[180]406 set column 0
407 foreach {input} [list "ADC" "delay" "decay"] {
408 label ${config(clip)}.label_${column} -text "${input}"
409 grid ${config(clip)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7
410 incr column
411 }
[143]412
[180]413 foreach {ch id} [array get adcCodes] {
[181]414 label ${config(clip)}.chan_${ch} -text "${id} "
[180]415 grid ${config(clip)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7
416 spinbox ${config(clip)}.delay_${ch} -from 0 -to 62 \
417 -increment 2 -width 10 -textvariable [myvar delay($ch)] \
418 -validate all -vcmd {::mca::validate 63 5 %P}
419 grid ${config(clip)}.delay_${ch} -row ${ch} -column 1 -sticky w -padx 5 -pady 7
420 spinbox ${config(clip)}.decay_${ch} -from 0 -to 65535 \
421 -increment 10 -width 10 -textvariable [myvar decay($ch)] \
422 -validate all -vcmd {::mca::validate 65535 5 %P}
423 grid ${config(clip)}.decay_${ch} -row ${ch} -column 2 -sticky w -padx 5 -pady 7
424 }
[143]425
[180]426 grid $config(clip) -row 0 -column 0 -sticky news -padx 10
[77]427
[186]428 grid ${thrs} -row 0 -column 2 -sticky news
429 grid ${bins} -row 0 -column 1 -sticky news
[180]430 grid ${clip} -row 0 -column 0 -sticky news
[77]431
[180]432 grid columnconfigure ${master} 0 -weight 1
433 grid columnconfigure ${master} 1 -weight 1
[186]434 grid columnconfigure ${master} 2 -weight 1
[180]435 grid rowconfigure ${master} 0 -weight 1
[77]436
[180]437 grid rowconfigure ${thrs} 0 -weight 0
[186]438 grid rowconfigure ${bins} 0 -weight 0
[180]439 grid rowconfigure ${clip} 0 -weight 0
[77]440 }
441
442# -------------------------------------------------------------------------
443
[180]444 CfgDisplay instproc decay_update args {
445 my instvar controller decay delay
[77]446
[143]447 set command {}
[180]448 for {set i 1} {$i <= 6} {incr i} {
449 set a $delay($i).0
450 set b $decay($i).0
[181]451 set value [expr int(exp(-${a}/${b})*1024*20)]
[188]452 append command [format {000200%02x0004%04x} [expr {38 + 2 * (${i} - 1)}] $value]
[180]453 }
[77]454
[143]455 $controller usbCmd $command
[73]456 }
457
458# -------------------------------------------------------------------------
459
[180]460 CfgDisplay instproc delay_update args {
461 my instvar controller delay
[73]462
[143]463 set command {}
[180]464 for {set i 1} {$i <= 6} {incr i} {
[188]465 append command [format {000200%02x0004%04x} [expr {39 + 2 * (${i} - 1)}] $delay($i)]
[180]466 }
[73]467
[143]468 $controller usbCmd $command
[73]469
[180]470 my decay_update
[73]471 }
472
473# -------------------------------------------------------------------------
474
[180]475 CfgDisplay instproc thrs_update args {
476 my instvar controller thrs
[73]477
[143]478 set command {}
[186]479 for {set i 0} {$i <= 27} {incr i} {
[180]480 append command [format {000200%02x0004%04x} [expr {10 + ${i}}] $thrs($i)]
481 }
[143]482
483 $controller usbCmd $command
[73]484 }
485
486# -------------------------------------------------------------------------
487
[143]488 Class MuxDisplay -parameter {
489 {master}
490 {controller}
[85]491 }
492
493# -------------------------------------------------------------------------
494
[143]495 MuxDisplay instproc init {} {
[73]496
[143]497 my setup
[73]498
[143]499 next
[73]500 }
501
502# -------------------------------------------------------------------------
503
[143]504 MuxDisplay instproc destroy {} {
505 next
[73]506 }
507
508# -------------------------------------------------------------------------
509
[143]510 MuxDisplay instproc start {} {
511 variable adcCodes
512 my instvar config chan_val
[74]513
[143]514 set chan_val(1) 0
515 set chan_val(2) 0
516 set chan_val(3) 0
517 set chan_val(4) 0
518 set chan_val(5) 0
519 set chan_val(6) 0
[85]520
[143]521 trace add variable [myvar chan_val] write [myproc chan_val_update]
522 trace add variable [myvar polar] write [myproc polar_update]
[74]523
[183]524 $config(1).chan_1_1 select
525 $config(2).chan_1_2 select
526 $config(3).chan_1_3 select
527 $config(4).chan_1_4 select
528 $config(5).chan_1_5 select
529 $config(6).chan_2_4 select
[143]530
531 foreach {ch dummy} [array get adcCodes] {
532 $config(inv).polar_${ch} deselect
533 }
[73]534 }
535
536# -------------------------------------------------------------------------
537
[143]538 MuxDisplay instproc setup {} {
539 variable oscCodes
540 variable adcCodes
541 variable inpCodes
542 my instvar master
543 my instvar config
[74]544
[143]545 set size [array size inpCodes]
546 set oscList [array get oscCodes]
547 set adcList [array get adcCodes]
548 set inpList [array get inpCodes]
[74]549
[143]550 set mux [frame ${master}.mux]
551 set key [frame ${master}.key]
552 set inv [frame ${master}.inv]
[180]553
[143]554 foreach {osc title} $oscList {
555 set config($osc) [labelframe ${mux}.$osc -borderwidth 1 -relief sunken -text $title]
556 foreach {code input} $inpList {
[183]557 set column [expr {$code + 1}]
[143]558 label $config($osc).input_${input} -text " ${input}"
559 grid $config($osc).input_${input} -row 0 -column ${column} -sticky w
[74]560 }
[181]561 foreach {ch id} $adcList {
562 label $config($osc).chan_${ch} -text "${id} "
[143]563 grid $config($osc).chan_${ch} -row ${ch} -column 0 -sticky ew
564 foreach {code input} $inpList {
565 set column [expr {$code + 1}]
566 set value [expr {$size * ($ch - 1) + $code}]
567 radiobutton $config($osc).chan_${code}_${ch} -variable [myvar chan_val($osc)] -value ${value}
568 grid $config($osc).chan_${code}_${ch} -row ${ch} -column ${column} -sticky w
569 }
[74]570 }
[183]571 set column [expr {($osc - 1) % 3}]
572 set row [expr {($osc - 1) / 3}]
[143]573 grid $config($osc) -row ${row} -column ${column} -sticky news -padx 10
[74]574 }
575
[143]576 set config(key) [labelframe ${key}.frame -borderwidth 1 -relief sunken -text {legend}]
[74]577
[183]578 label $config(key).rs -text "rs - raw signal"
579 grid $config(key).rs -row 0 -column 0 -sticky news
[74]580
[183]581 label $config(key).cs -text "cs - filtered and clipped signal"
582 grid $config(key).cs -row 0 -column 1 -sticky news
[180]583
[183]584 label $config(key).av -text "av - amplitude value"
585 grid $config(key).av -row 0 -column 2 -sticky news
[180]586
[183]587 label $config(key).af -text "af - amplitude flag"
588 grid $config(key).af -row 0 -column 3 -sticky news
[74]589
[183]590 label $config(key).bn -text "bn - bin number"
591 grid $config(key).bn -row 0 -column 4 -sticky news
592
593 label $config(key).bf -text "bf - bin flag"
594 grid $config(key).bf -row 0 -column 5 -sticky news
595
[143]596 grid $config(key) -row 0 -column 0 -sticky news -padx 10
597
[180]598
[143]599 set config(inv) [labelframe ${inv}.frame -borderwidth 1 -relief sunken -text {polarity inversion}]
600 label $config(inv).chan_label -text "channel "
601 grid $config(inv).chan_label -row 0 -column 0 -sticky e
602 label $config(inv).polar_label -text "polarity"
603 grid $config(inv).polar_label -row 1 -column 0 -sticky e
604 foreach {ch dummy} $adcList {
605 label $config(inv).chan_${ch} -text "${ch} "
606 grid $config(inv).chan_${ch} -row 0 -column ${ch} -sticky ew
607 checkbutton $config(inv).polar_${ch} -variable [myvar polar($ch)]
608 grid $config(inv).polar_${ch} -row 1 -column ${ch} -sticky w
[74]609 }
[143]610 grid $config(inv) -row 0 -column 0 -sticky news -padx 10
[74]611
[143]612 grid ${key} -row 0 -column 0 -sticky news
613 grid ${mux} -row 1 -column 0 -sticky news
614 grid ${inv} -row 2 -column 0 -sticky news
[74]615
[143]616 grid columnconfigure ${master} 0 -weight 1
617 grid rowconfigure ${master} 0 -weight 1
618 grid rowconfigure ${master} 1 -weight 1
619 grid rowconfigure ${master} 2 -weight 1
[73]620
[143]621 grid columnconfigure ${inv} 0 -weight 1
[73]622
[143]623 grid columnconfigure ${key} 0 -weight 1
624 grid columnconfigure $config(key) 0 -weight 1
625 grid columnconfigure $config(key) 1 -weight 1
626 grid columnconfigure $config(key) 2 -weight 1
627 grid columnconfigure $config(key) 3 -weight 1
[183]628 grid columnconfigure $config(key) 4 -weight 1
629 grid columnconfigure $config(key) 5 -weight 1
[143]630
[180]631
[143]632 grid columnconfigure ${mux} 0 -weight 1
633 grid columnconfigure ${mux} 1 -weight 1
634 grid columnconfigure ${mux} 2 -weight 1
[73]635 }
636
[143]637# ------------------------------------------------------------------------
[73]638
[143]639 MuxDisplay instproc chan_val_update args {
640 my instvar controller chan_val
[73]641
[143]642 set byte1 [format {%02x%02x} $chan_val(2) $chan_val(1)]
643 set byte2 [format {%02x%02x} $chan_val(4) $chan_val(3)]
644 set byte3 [format {%02x%02x} $chan_val(6) $chan_val(5)]
[73]645
[143]646 $controller usbCmd 000200020004${byte1}000200030004${byte2}000200040004${byte3}
[73]647 }
648
649# -------------------------------------------------------------------------
650
[143]651 MuxDisplay instproc polar_update args {
652 my instvar controller polar
[180]653
[143]654 set value {0b}
[180]655 for {set i 6} {$i >= 1} {incr i -1} {
656 append value $polar($i)
[143]657 }
[73]658
[143]659 set value [format {%04x} $value]
[73]660
[143]661 $controller usbCmd 000200010004${value}
[73]662 }
663
664# -------------------------------------------------------------------------
665
[143]666 Class HstDisplay -parameter {
[73]667 {number}
668 {master}
[143]669 {controller}
[73]670 }
671
672# -------------------------------------------------------------------------
673
674 HstDisplay instproc init {} {
675
[143]676 my set data {}
[73]677
[186]678 vector create [myvar xvec](80)
679 vector create [myvar yvec](80)
[73]680
[186]681 # fill one vector for the x axis with 80 points
682 [myvar xvec] seq -0.5 79.5
[143]683
[73]684 my setup
685
686 next
687 }
688
689# -------------------------------------------------------------------------
690
691 HstDisplay instproc destroy {} {
692 next
693 }
694
695# -------------------------------------------------------------------------
696
697 HstDisplay instproc start {} {
[143]698 my instvar config
[73]699
[143]700 trace add variable [myvar data] write [myproc data_update]
[73]701
[85]702 trace add variable [myvar axis] write [myproc axis_update]
[73]703
[143]704 ${config}.axis_check select
[85]705
[143]706 my set yvec_bak 0.0
707 my set yvec_old 0.0
[73]708 }
709
710# -------------------------------------------------------------------------
711
712 HstDisplay instproc setup {} {
713 my instvar number master
[143]714 my instvar xvec yvec graph
715 my instvar config thrs thrs_val base base_typ base_val
716 my instvar cntr_h cntr_m cntr_s
[73]717
718 # create a graph widget and show a grid
719 set graph [graph ${master}.graph -height 250 -leftmargin 80]
[143]720 $graph crosshairs configure -hide no -linewidth 1 -color darkblue -dashes {2 2}
[73]721 $graph grid configure -hide no
722 $graph legend configure -hide yes
[186]723 $graph axis configure x -min 0 -max 80
[73]724
[143]725 set config [frame ${master}.config -width 170]
[73]726
[85]727 checkbutton ${config}.axis_check -text {log scale} -variable [myvar axis]
[73]728
[143]729 frame ${config}.spc1 -width 170 -height 30
[73]730
[143]731 frame ${config}.chan_frame -borderwidth 0 -width 170
732 legendLabel ${config}.chan_frame 0 axisy {Bin entries}
733 legendLabel ${config}.chan_frame 1 axisx {Bin number}
[85]734
[180]735 frame ${config}.spc2 -width 170 -height 30
[85]736
[143]737 button ${config}.start -text Start \
738 -bg yellow -activebackground yellow -command [myproc cntr_start]
739 button ${config}.reset -text Reset \
740 -bg red -activebackground red -command [myproc cntr_reset]
741
[180]742 frame ${config}.spc3 -width 170 -height 30
[143]743
[73]744 button ${config}.register -text Register \
745 -bg lightblue -activebackground lightblue -command [myproc register]
746
[85]747 grid ${config}.axis_check -sticky w
748 grid ${config}.spc1
[180]749 grid ${config}.chan_frame -sticky ew -padx 5
[85]750 grid ${config}.spc2
[143]751 grid ${config}.start -sticky ew -pady 3 -padx 5
752 grid ${config}.reset -sticky ew -pady 3 -padx 5
[180]753 grid ${config}.spc3
[73]754 grid ${config}.register -sticky ew -pady 3 -padx 5
755
756 grid ${graph} -row 0 -column 0 -sticky news
757 grid ${config} -row 0 -column 1
758
[77]759 grid rowconfigure ${master} 0 -weight 1
760 grid columnconfigure ${master} 0 -weight 1
761 grid columnconfigure ${master} 1 -weight 0 -minsize 80
762
[143]763 grid columnconfigure ${config}.chan_frame 1 -weight 1
764
[73]765 # enable zooming
766 Blt_ZoomStack $graph
767
[143]768 my crosshairs $graph
769
[73]770 #bind .graph <Motion> {%W crosshairs configure -position @%x,%y}
771
772 # create one element with data for the x and y axis, no dots
[143]773 $graph element create Spectrum1 -color blue -linewidth 2 -symbol none -smooth step -xdata [myvar xvec] -ydata [myvar yvec]
[73]774 }
775
776# -------------------------------------------------------------------------
777
[143]778 HstDisplay instproc coor_update {W x y} {
779 my instvar config graph
[85]780
[143]781 $W crosshairs configure -position @${x},${y}
[85]782
[143]783 set index [$W axis invtransform x $x]
784 set index [::tcl::mathfunc::round $index]
785 catch {
786 ${config}.chan_frame.axisy_value configure -text [[myvar yvec] index $index]
787 ${config}.chan_frame.axisx_value configure -text ${index}.0
788 }
[85]789 }
790# -------------------------------------------------------------------------
791
[143]792 HstDisplay instproc crosshairs {graph} {
793 set method [myproc coor_update]
794 bind $graph <Motion> [list [self] coor_update %W %x %y]
795 bind $graph <Leave> {
796 %W crosshairs off
[73]797 }
[143]798 bind $graph <Enter> {
799 %W crosshairs on
800 }
[73]801 }
802
803# -------------------------------------------------------------------------
804
[143]805 HstDisplay instproc axis_update args {
806 my instvar axis graph
807 if {$axis} {
808 $graph axis configure y -min 1 -max 1E10 -logscale yes
[73]809 } else {
[143]810 $graph axis configure y -min {} -max {} -logscale no
[73]811 }
812 }
813
814# -------------------------------------------------------------------------
815
[143]816 HstDisplay instproc cntr_reset {} {
[180]817 my instvar controller number
[143]818
819 my cntr_stop
820
821 set value [format %04x [expr {1 << (5 + ${number})}]]
822 $controller usbCmd 000200000004${value}0002000000040000
823
824 my acquire
825 }
826
827# -------------------------------------------------------------------------
828
829 HstDisplay instproc cntr_start {} {
830 my instvar controller config number auto
831
[180]832 set val_addr [format %02x [expr {6 + ${number}}]]
[143]833
[180]834 ${config}.start configure -text Stop -command [myproc cntr_stop]
[143]835# ${config}.reset configure -state disabled
836
[180]837 $controller usbCmd 000200${val_addr}00040001
[143]838
839 set auto 1
840
841 after 100 [myproc acquire_loop]
842 }
843
844# -------------------------------------------------------------------------
845
846 HstDisplay instproc cntr_stop {} {
847 my instvar controller config number auto
848
[180]849 set val_addr [format %02x [expr {6 + ${number}}]]
[143]850
[180]851 ${config}.start configure -text Start -command [myproc cntr_start]
852
[143]853 $controller usbCmd 000200${val_addr}00040000
854
855 set auto 0
[180]856
857 my acquire
[143]858 }
859
860# -------------------------------------------------------------------------
861
862 HstDisplay instproc data_update args {
863 my instvar data
864 usb::convertBlt $data 4 [myvar yvec]
865 }
866
867# -------------------------------------------------------------------------
868
[85]869 HstDisplay instproc acquire_loop {} {
[143]870 my instvar cntr_val auto
[73]871
[85]872 my acquire
873
[180]874 if {$auto} {
[143]875 after 1000 [myproc acquire_loop]
876 }
[85]877 }
878
879# -------------------------------------------------------------------------
880
[143]881 HstDisplay instproc acquire {} {
882 my instvar controller config number
[85]883
[186]884 set size 80
[143]885
886 set prefix [format {%x} [expr {$number + 2}]]
887
888 set value [format {%08x} [expr {$size * 2}]]
889
890 set command 0001${prefix}000000200000001[string range $value 0 3]0003[string range $value 4 7]00050000
891
892 $controller usbCmdReadRaw $command [expr {$size * 4}] [myvar data]
893 }
894
[85]895# -------------------------------------------------------------------------
896
[143]897 HstDisplay instproc save_data {data} {
898 my instvar number
[85]899
[143]900 set types {
901 {{Data Files} {.dat} }
902 {{All Files} * }
903 }
[85]904
[143]905 set stamp [clock format [clock seconds] -format %Y%m%d_%H%M%S]
906 set fname spectrum_[expr {$number + 1}]_${stamp}.dat
907
908 set fname [tk_getSaveFile -filetypes $types -initialfile $fname]
909 if {[string equal $fname {}]} {
910 return
[73]911 }
[85]912
[143]913 set x [catch {
914 set fid [open $fname w+]
915 puts $fid $data
916 close $fid
917 }]
[85]918
[143]919 if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } {
920 tk_messageBox -icon error \
921 -message "An error occurred while writing to \"$fname\""
922 } else {
923 tk_messageBox -icon info \
924 -message "File \"$fname\" written successfully"
925 }
926 }
[85]927
[143]928# -------------------------------------------------------------------------
[85]929
[143]930 HstDisplay instproc register {} {
[186]931 my save_data [join [[myvar yvec] range 0 79] \n]
[73]932 }
933
934# -------------------------------------------------------------------------
935
[143]936 Class OscDisplay -parameter {
[85]937 {master}
[143]938 {controller}
[85]939 }
940
941# -------------------------------------------------------------------------
942
[143]943 OscDisplay instproc init {} {
944 my instvar sequence data xvec yvec
[85]945
[143]946 set data {}
[180]947
[143]948 set sequence 0
[85]949
[143]950# set xvec [vector create #auto(262144)]
[180]951# set xvec [vector create #auto(10000)]
952 set xvec [vector create #auto(60000)]
[143]953
954 for {set i 1} {$i <= 9} {incr i} {
955# dict set yvec $i [vector create #auto(262144)]
[180]956# dict set yvec $i [vector create #auto(10000)]
957 dict set yvec $i [vector create #auto(60000)]
[143]958 }
959
[85]960 # fill one vector for the x axis
[143]961# $xvec seq 0 262143
[180]962# $xvec seq 0 10000
963 $xvec seq 0 60000
[85]964
965 my setup
966
967 next
968 }
969
970# -------------------------------------------------------------------------
971
[143]972 OscDisplay instproc destroy {} {
[85]973 next
974 }
975
976# -------------------------------------------------------------------------
977
[143]978 OscDisplay instproc start {} {
979 my instvar config
980 my instvar recs_val directory
[85]981
[180]982 set directory $::env(HOME)
[143]983 set recs_val 100
[85]984
[143]985 trace add variable [myvar chan] write [myproc chan_update]
[85]986
[143]987 trace add variable [myvar data] write [myproc data_update]
[85]988
[143]989 trace add variable [myvar auto] write [myproc auto_update]
[85]990
[143]991 trace add variable [myvar thrs] write [myproc thrs_update 0]
992 trace add variable [myvar thrs_val] write [myproc thrs_update 0]
993
994 trace add variable [myvar recs_val] write [myproc recs_val_update]
995
996 trace add variable [myvar last] write [myproc last_update]
997
[180]998 for {set i 1} {$i <= 6} {incr i} {
999 ${config}.chan_frame.chan${i}_check select
1000 ${config}.chan_frame.chan${i}_value configure -text 0.0
1001 }
1002 ${config}.chan_frame.axisx_value configure -text 0.0
[143]1003
1004 ${config}.thrs_check select
[183]1005 ${config}.thrs_field set 60
[85]1006 }
1007
1008# -------------------------------------------------------------------------
1009
[143]1010 OscDisplay instproc setup {} {
[85]1011 my instvar master
[143]1012 my instvar xvec yvec graph
1013 my instvar config
[85]1014
1015 # create a graph widget and show a grid
1016 set graph [graph ${master}.graph -height 250 -leftmargin 80]
[143]1017 $graph crosshairs configure -hide no -linewidth 1 -color darkblue -dashes {2 2}
[85]1018 $graph grid configure -hide no
1019 $graph legend configure -hide yes
[180]1020 $graph axis configure x -min 0 -max 60000
[143]1021 $graph axis configure y -min 0 -max 4100
[85]1022
[143]1023# scale ${master}.last -orient horizontal -from 1 -to 27 -tickinterval 0 -showvalue no -variable [myvar last]
[85]1024
[143]1025 set config [frame ${master}.config -width 170]
[85]1026
[143]1027 frame ${config}.chan_frame -width 170
1028 legendButton ${config}.chan_frame 0 chan1 {Channel 1} [myvar chan(1)] turquoise2
1029 legendButton ${config}.chan_frame 1 chan2 {Channel 2} [myvar chan(2)] SpringGreen2
1030 legendButton ${config}.chan_frame 2 chan3 {Channel 3} [myvar chan(3)] orchid2
1031 legendButton ${config}.chan_frame 3 chan4 {Channel 4} [myvar chan(4)] orange2
1032 legendButton ${config}.chan_frame 4 chan5 {Channel 5} [myvar chan(5)] blue1 white
1033 legendButton ${config}.chan_frame 5 chan6 {Channel 6} [myvar chan(6)] gray65 white
1034 legendLabel ${config}.chan_frame 6 axisx {Time axis}
1035
1036 frame ${config}.spc1 -width 170 -height 30
1037
1038 checkbutton ${config}.auto_check -text {auto update} -variable [myvar auto]
1039
1040 frame ${config}.spc2 -width 170 -height 30
1041
1042 checkbutton ${config}.thrs_check -text threshold -variable [myvar thrs]
1043 spinbox ${config}.thrs_field -from 1 -to 4095 \
1044 -increment 5 -width 10 -textvariable [myvar thrs_val] \
1045 -validate all -vcmd {::mca::validate 4095 4 %P}
1046
1047 frame ${config}.spc3 -width 170 -height 30
1048
[85]1049 button ${config}.acquire -text Acquire \
[143]1050 -bg green -activebackground green -command [myproc acquire_start]
[85]1051 button ${config}.register -text Register \
1052 -bg lightblue -activebackground lightblue -command [myproc register]
1053
[143]1054 frame ${config}.spc4 -width 170 -height 30
1055
1056 label ${config}.recs -text {number of records}
1057 spinbox ${config}.recs_field -from 0 -to 10000 \
1058 -increment 10 -width 10 -textvariable [myvar recs_val] \
1059 -validate all -vcmd {::mca::validate 10000 5 %P}
1060
1061 frame ${config}.spc5 -width 170 -height 10
1062
1063 button ${config}.sequence -text {Start Recording} -command [myproc sequence_start] \
1064 -bg yellow -activebackground yellow
1065
[180]1066 frame ${config}.spc6 -width 170 -height 30
[143]1067
1068 button ${config}.recover -text {Read file} \
1069 -bg lightblue -activebackground lightblue -command [myproc recover]
1070
1071 grid ${config}.chan_frame -sticky ew
1072 grid ${config}.spc1
1073 grid ${config}.auto_check -sticky w
1074 grid ${config}.spc2
1075 grid ${config}.thrs_check -sticky w
1076 grid ${config}.thrs_field -sticky ew -pady 1 -padx 5
1077 grid ${config}.spc3
[85]1078 grid ${config}.acquire -sticky ew -pady 3 -padx 5
1079 grid ${config}.register -sticky ew -pady 3 -padx 5
[143]1080 grid ${config}.spc4
1081 grid ${config}.recs -sticky w -pady 1 -padx 3
1082 grid ${config}.recs_field -sticky ew -pady 1 -padx 5
1083 grid ${config}.spc5
1084 grid ${config}.sequence -sticky ew -pady 3 -padx 5
1085 grid ${config}.spc6
1086 grid ${config}.recover -sticky ew -pady 3 -padx 5
[85]1087
1088 grid ${graph} -row 0 -column 0 -sticky news
1089 grid ${config} -row 0 -column 1
1090
[143]1091# grid ${master}.last -row 1 -column 0 -columnspan 2 -sticky ew
[85]1092
1093 grid rowconfigure ${master} 0 -weight 1
1094 grid columnconfigure ${master} 0 -weight 1
[143]1095 grid columnconfigure ${master} 1 -weight 0 -minsize 120
[85]1096
[143]1097 grid columnconfigure ${config}.chan_frame 2 -weight 1
1098
[85]1099 # enable zooming
1100 Blt_ZoomStack $graph
1101
[143]1102 my crosshairs $graph
[85]1103
1104 # create one element with data for the x and y axis, no dots
[143]1105 $graph pen create pen1 -color turquoise3 -linewidth 2 -symbol none
1106 $graph pen create pen2 -color SpringGreen3 -linewidth 2 -symbol none
1107 $graph pen create pen3 -color orchid3 -linewidth 2 -symbol none
1108 $graph pen create pen4 -color orange3 -linewidth 2 -symbol none
1109 $graph pen create pen5 -color blue2 -linewidth 2 -symbol none
1110 $graph pen create pen6 -color gray55 -linewidth 2 -symbol none
1111
1112 $graph element create Spectrum1 -pen pen1 -xdata $xvec -ydata [dict get $yvec 1]
1113 $graph element create Spectrum2 -pen pen2 -xdata $xvec -ydata [dict get $yvec 2]
1114 $graph element create Spectrum3 -pen pen3 -xdata $xvec -ydata [dict get $yvec 3]
1115 $graph element create Spectrum4 -pen pen4 -xdata $xvec -ydata [dict get $yvec 4]
1116 $graph element create Spectrum5 -pen pen5 -xdata $xvec -ydata [dict get $yvec 5]
1117 $graph element create Spectrum6 -pen pen6 -xdata $xvec -ydata [dict get $yvec 6]
[85]1118 }
1119
1120# -------------------------------------------------------------------------
1121
[143]1122 OscDisplay instproc coor_update {W x y} {
1123 my instvar xvec yvec graph
1124 my instvar config
[85]1125
[143]1126 $W crosshairs configure -position @${x},${y}
1127
1128 set index [$W axis invtransform x $x]
1129 set index [::tcl::mathfunc::round $index]
1130 catch {
1131 ${config}.chan_frame.chan1_value configure -text [[dict get $yvec 1] index $index]
1132 ${config}.chan_frame.chan2_value configure -text [[dict get $yvec 2] index $index]
1133 ${config}.chan_frame.chan3_value configure -text [[dict get $yvec 3] index $index]
1134 ${config}.chan_frame.chan4_value configure -text [[dict get $yvec 4] index $index]
1135 ${config}.chan_frame.chan5_value configure -text [[dict get $yvec 5] index $index]
1136 ${config}.chan_frame.chan6_value configure -text [[dict get $yvec 6] index $index]
1137 ${config}.chan_frame.axisx_value configure -text ${index}.0
1138 }
1139 }
1140# -------------------------------------------------------------------------
1141
1142 OscDisplay instproc crosshairs {graph} {
1143 set method [myproc coor_update]
1144 bind $graph <Motion> [list [self] coor_update %W %x %y]
1145 bind $graph <Leave> {
1146 %W crosshairs off
1147 }
1148 bind $graph <Enter> {
1149 %W crosshairs on
1150 }
1151 }
1152
1153# -------------------------------------------------------------------------
1154
1155 OscDisplay instproc chan_update {name key op} {
1156 my instvar config graph chan
1157
1158 if {$chan(${key})} {
1159 $graph pen configure pen${key} -linewidth 2
1160 } else {
1161 $graph pen configure pen${key} -linewidth 0
1162 }
1163 }
1164
1165# -------------------------------------------------------------------------
1166
1167 OscDisplay instproc recs_val_update args {
1168 my instvar recs_val
1169 if {[string equal $recs_val {}]} {
1170 set recs_val 0
1171 }
1172 }
1173
1174# -------------------------------------------------------------------------
1175
1176 OscDisplay instproc last_update args {
1177 my instvar graph last
1178
[85]1179 set first [expr {$last - 1}]
[143]1180
1181 $graph axis configure x -min ${first}0000 -max ${last}0000
[85]1182 }
1183
1184# -------------------------------------------------------------------------
1185
[143]1186 OscDisplay instproc thrs_update {reset args} {
1187 my instvar controller config thrs thrs_val
1188
1189 if {[string equal $thrs_val {}]} {
1190 set thrs_val 0
1191 }
1192
1193 if {$thrs} {
1194 ${config}.thrs_field configure -state normal
[180]1195 set value [format {%03x} $thrs_val]
[143]1196 } else {
1197 ${config}.thrs_field configure -state disabled
1198 set value 000
1199 }
1200
1201 set command {}
1202 if {$reset} {
1203 append command 0002000500041${value}
1204 }
1205 append command 0002000500040${value}
1206
1207 $controller usbCmd $command
1208 }
1209
1210# -------------------------------------------------------------------------
1211
1212 OscDisplay instproc data_update args {
1213 my instvar data yvec
1214 my instvar graph chan waiting sequence auto
1215
1216 usb::convertOsc $data $yvec
1217
1218 foreach {key value} [array get chan] {
1219 $graph pen configure pen${key} -dashes 0
1220 }
1221
1222 set waiting 0
1223
1224 if {$sequence} {
1225 my sequence_register
1226 } elseif {$auto} {
1227 after 1000 [myproc acquire_start]
1228 }
1229 }
1230
1231# -------------------------------------------------------------------------
1232
1233 OscDisplay instproc acquire_start {} {
1234 my instvar graph chan controller waiting
1235
1236 foreach {key value} [array get chan] {
1237 $graph pen configure pen${key} -dashes dot
1238 }
1239
1240 # restart
1241 my thrs_update 1
1242
1243 set waiting 1
1244
1245 after 200 [myproc acquire_loop]
1246 }
1247
1248# -------------------------------------------------------------------------
1249
1250 OscDisplay instproc acquire_loop {} {
1251 my instvar controller waiting
1252
1253# set size 262144
[180]1254# set size 10000
1255 set size 60000
[143]1256
1257 set value [format {%08x} [expr {$size * 4}]]
1258
1259 set command 00011000000200000001[string range $value 0 3]0003[string range $value 4 7]00050000
[180]1260
[143]1261 $controller usbCmdReadRaw $command [expr {$size * 8}] [myvar data]
1262
1263 if {$waiting} {
1264 after 200 [myproc acquire_loop]
1265 }
1266 }
1267
1268# -------------------------------------------------------------------------
1269
1270 OscDisplay instproc auto_update args {
1271 my instvar config auto
1272
1273 if {$auto} {
1274 ${config}.recs_field configure -state disabled
1275 ${config}.sequence configure -state disabled
1276 ${config}.acquire configure -state disabled
1277 ${config}.register configure -state disabled
1278 ${config}.recover configure -state disabled
1279
1280 my acquire_start
1281 } else {
1282 ${config}.recs_field configure -state normal
1283 ${config}.sequence configure -state active
1284 ${config}.acquire configure -state active
1285 ${config}.register configure -state active
1286 ${config}.recover configure -state active
1287 }
1288 }
1289
1290# -------------------------------------------------------------------------
1291
1292 OscDisplay instproc save_data {fname} {
1293 my instvar data
1294
1295 set fid [open $fname w+]
1296 fconfigure $fid -translation binary -encoding binary
1297
1298# puts -nonewline $fid [binary format "H*iH*" "1f8b0800" [clock seconds] "0003"]
1299# puts -nonewline $fid [zlib deflate $data]
1300 puts -nonewline $fid $data
1301# puts -nonewline $fid [binary format i [zlib crc32 $data]]
1302# puts -nonewline $fid [binary format i [string length $data]]
1303
1304 close $fid
1305 }
1306
1307# -------------------------------------------------------------------------
1308
1309 OscDisplay instproc open_data {} {
1310 set types {
1311 {{Data Files} {.dat} }
1312 {{All Files} * }
1313 }
1314
1315 set fname [tk_getOpenFile -filetypes $types]
1316 if {[string equal $fname {}]} {
[85]1317 return
1318 }
1319
[143]1320 set x [catch {
1321 set fid [open $fname r+]
1322 fconfigure $fid -translation binary -encoding binary
1323# set size [file size $fname]
1324# seek $fid 10
1325# my set data [zlib inflate [read $fid [expr {$size - 18}]]]
1326 my set data [read $fid]
1327 close $fid
1328 }]
[85]1329
[143]1330 if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } {
[85]1331 tk_messageBox -icon error \
[143]1332 -message "An error occurred while reading \"$fname\""
[85]1333 } else {
1334 tk_messageBox -icon info \
[143]1335 -message "File \"$fname\" read successfully"
[85]1336 }
1337 }
1338
1339# -------------------------------------------------------------------------
1340
[143]1341 OscDisplay instproc register {} {
1342 set types {
1343 {{Data Files} {.dat} }
1344 {{All Files} * }
1345 }
[85]1346
[180]1347 set stamp [clock format [clock seconds] -format {%Y%m%d_%H%M%S}]
[143]1348 set fname oscillogram_${stamp}.dat
1349
1350 set fname [tk_getSaveFile -filetypes $types -initialfile $fname]
1351 if {[string equal $fname {}]} {
1352 return
1353 }
[180]1354
[143]1355 if {[catch {my save_data $fname} result]} {
1356 tk_messageBox -icon error \
1357 -message "An error occurred while writing to \"$fname\""
1358 } else {
1359 tk_messageBox -icon info \
1360 -message "File \"$fname\" written successfully"
1361 }
1362 }
1363
[85]1364# -------------------------------------------------------------------------
1365
[143]1366 OscDisplay instproc recover {} {
1367 my open_data
[85]1368 }
1369
1370# -------------------------------------------------------------------------
1371
[143]1372 OscDisplay instproc sequence_start {} {
1373 my instvar config recs_val recs_bak directory counter sequence
1374
1375 set counter 1
1376 if {$counter > $recs_val} {
1377 return
1378 }
1379
1380 set directory [tk_chooseDirectory -initialdir $directory -title {Choose a directory}]
1381
1382 if {[string equal $directory {}]} {
1383 return
1384 }
1385
1386 ${config}.recs_field configure -state disabled
1387 ${config}.sequence configure -text {Stop Recording} -command [myproc sequence_stop]
1388 ${config}.acquire configure -state disabled
1389 ${config}.register configure -state disabled
1390 ${config}.recover configure -state disabled
[180]1391
[143]1392 set recs_bak $recs_val
1393
1394 set sequence 1
1395
1396 my acquire_start
1397 }
1398
1399# -------------------------------------------------------------------------
1400
1401 OscDisplay instproc sequence_register {} {
1402 my instvar config recs_val recs_bak directory counter
1403
1404 set fname [file join $directory oscillogram_$counter.dat]
1405
1406 my incr counter
1407
1408 if {[catch {my save_data $fname} result]} {
1409 tk_messageBox -icon error \
1410 -message "An error occurred while writing to \"$fname\""
1411 } elseif {$counter <= $recs_bak} {
1412 set recs_val [expr {$recs_bak - $counter}]
1413 my acquire_start
1414 return
1415 }
[180]1416
[143]1417 my sequence_stop
1418 }
1419
1420# -------------------------------------------------------------------------
1421
1422 OscDisplay instproc sequence_stop {} {
1423 my instvar config recs_val recs_bak sequence
1424
1425 set sequence 0
[180]1426
[143]1427 set recs_val $recs_bak
1428
1429 ${config}.recs_field configure -state normal
1430 ${config}.sequence configure -text {Start Recording} -command [myproc sequence_start]
1431 ${config}.acquire configure -state active
1432 ${config}.register configure -state active
1433 ${config}.recover configure -state active
1434 }
1435
1436# -------------------------------------------------------------------------
1437
1438 namespace export MuxDisplay
[73]1439 namespace export HstDisplay
[180]1440 namespace export CfgDisplay
[73]1441 namespace export OscDisplay
1442}
1443
[78]1444set notebook [::blt::tabnotebook .notebook -borderwidth 1 -selectforeground black -side bottom]
[73]1445
[143]1446grid ${notebook} -row 0 -column 0 -sticky news -pady 5
[73]1447
[78]1448grid rowconfigure . 0 -weight 1
[143]1449grid columnconfigure . 0 -weight 1
[78]1450
[143]1451::mca::UsbController usb
[73]1452
[143]1453set window [frame ${notebook}.mux]
1454$notebook insert end -text "Interconnect" -window $window -fill both
1455::mca::MuxDisplay mux -master $window -controller usb
[73]1456
[180]1457set window [frame ${notebook}.cfg]
1458$notebook insert end -text "Configuration" -window $window -fill both
1459::mca::CfgDisplay cfg -master $window -controller usb
1460
1461set window [frame ${notebook}.hst]
1462$notebook insert end -text "Histogram" -window $window -fill both
1463::mca::HstDisplay hst -number 0 -master $window -controller usb
1464
[85]1465set window [frame ${notebook}.ept]
[143]1466$notebook insert end -text "Oscilloscope" -window $window -fill both
1467::mca::OscDisplay osc -master $window -controller usb
[85]1468
[143]1469update
[85]1470
[180]1471cfg start
[73]1472
[143]1473mux start
[73]1474
[180]1475hst start
1476
[143]1477osc start
Note: See TracBrowser for help on using the repository browser.