Am 07.05.12 18:15, schrieb Robert Heller:
> At Mon, 7 May 2012 10:40:25 -0500 "Bob"<
kva...@nopa.com> wrote:
> Try this:
>
> global count
> set count 0
> global text
> set text [text .text1]
> pack $text -expand yes -fill both
>
> proc getonevalue {} {
> global count
> global text
> set value [gpib read]
> $text insert 1.0 "$value\n"
> $text delete 2.0 end
> incr count
> if {$count< 10} {
> after 1000 getonevalue
> }
> }
I second this answer. Also note, that if your device generates data with
its own timer, and you want to see all values, you should enable SRQ and
wait for that event. Typically, you activate SRQ by sending the "*SRE"
command to the device. With gpib-tcl, you can wait on SRQ by
gpib wait -event srq
NI also supports asnychronous callbacks for SRQ to get truly event based
programs. To use them, I have done my own GPIB library available here:
http://sourceforge.net/projects/gpib-tclsrq/
With it, you get an OO interface to GPIB devices. Assuming your device
has address 8 on the bus you can do:
=============================
package require gpibsrq
gpibdevice dev 8
dev write "*SRE65" ;# must adopt this to your device
proc getonevalue {} {
global text
$text insert 1.0 [dev read]
}
dev srq getonevalue
==============================
and you should see a live update of the measured values
Christian