File: example1.tcl

package info (click to toggle)
linux-gpib-user 4.3.7-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,760 kB
  • sloc: ansic: 10,381; perl: 1,120; xml: 375; makefile: 335; yacc: 335; tcl: 308; python: 173; php: 157; lex: 144; sh: 134; lisp: 94
file content (85 lines) | stat: -rwxr-xr-x 2,056 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/wish -f
#
# This example is a simple Digital Voltmeter display
#
#
#

load ../libgpib_tcl.so

#
# init device
#---------------------------------------------
 
set device [gpib find voltmeter ]

gpib sic   $device
gpib ren   $device 1
gpib clear $device
gpib write $device "D1Ready"
gpib write $device "D0L0Q1OT1A1"
#gpib write $device "D0L0Q1OT2"

#---------------------------------------------
#

set result [gpib read $device 15]

set mode "V"
set refresh 50
set block 0

proc displ_refresh {} {
	global result device refresh block mode

	gpib wait $device srq


	.light configure -background red
	update
        set result [gpib read $device 15 ]$mode
        
	if { $block == 0 } { 
		after $refresh displ_refresh
        }
	.light configure -background steelblue
	update
}

proc Mode { mod } {
 global mode
 set mode $mod
}


label  .lab  -text "GPIB Demo" -font -adobe-times-bold-r-normal--18-180-75-75-p-99-iso8859-1 -justify right
label .light -width 1 -height 1 -relief raised -text "*"

label  .val  -width 15 -textvariable result -relief sunken -font -adobe-helvetica-bold-r-normal--24-240-75-75-p-138-iso8859-1

button .but1 -text "Quit" -command { set block 1; update idletasks ;gpib close $device ; exit}
button .but2 -text "Ohm"  -command { gpib write $device "O2" ; Mode "Ohm" }
button .but3 -text "V ~"   -command { gpib write $device "VA" ; Mode "V" }
button .but4 -text "V ="   -command { gpib write $device "VD" ; Mode "V" }
button .but5 -text "A ~"   -command { gpib write $device "IA" ; Mode "A" }
button .but6 -text "A ="   -command { gpib write $device "ID" ; Mode "A" }
button .but7 -text "AutoRange"  -command { gpib write $device "A1" }
button .but8 -text "NoAuto" -command { gpib write $device "A0" }


pack append . .lab { top fillx} .val { top fillx } .light {right fillx }  
pack append . .but1 { bottom fillx } .but2 { bottom fillx } .but3 { bottom fillx } \
              .but4 { bottom fillx} .but5 { bottom fillx} .but6 { bottom fillx} \
	      .but7 { top filly } .but8 { top filly }

displ_refresh