EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Channel Access and Tcl
From: Bob Soliday <[email protected]>
To: John Dobbins <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Tue, 19 Dec 2006 16:23:17 -0600
I maintain oagwish so I would definitely recommend it :) It started with et_wish but has evolved since then. But the basics are still the same. Your command "pv linkw cur PVname" does not set the variable "cur" in the current context, instead it sets the global variable "cur". Also you probably always want to use linkw and putw instead of link and put. This way you don't have to use any pv info commands in some loop waiting for the PV to respond. So your code would look like:

proc my_test {} {
   global cur errorCode
   if {[pv linkw cur bl_mag_crv1_cmd] != 0} {
	puts "error: $errorCode"
	exit
   }
   set cur 0.001
   puts "cur = $cur"
   if {[pv putw cur] != 0} {
	puts "error: $errorCode"
	exit
   }
   puts "executed test"
}
my_test

Hope this helps,
--Bob Soliday

John Dobbins wrote:
Dear All,

(Preface: new to using Tcl so please don't assume I know what I'm doing)

I have built et_wish from the distribution

http://www.aps.anl.gov/epics/download/extensions/caTCL_20020802.tar.gz

I can start et_wish and the various Channel Access commands work fine from the et_wish command line, but when I try to use them from inside a proc they stop working. If inside a proc I use

  pv link variable_name record_name
  pv put variable_name

then the value of the record remains unchanged. See example code below.


1) Does anyone have any ideas about this? (Tcl8.3.5 on Scientific Linux 3)

2) I see that oagwish from APS appears more actively maintained. Should I be using this instead?

Thanks

John Dobbins



This et_wish command line code works:

% pv link cur bl_mag_crv1_cmd
0
% set cur 0.001
0.001
% pv put cur
0


This script does not:


proc my_test {} {

    pv linkw cur bl_mag_crv1_cmd
    set x  [pv info cur state]
    puts $x

    set cur 0.001
    puts "cur = $cur"
    pv put cur

after 50

    set x  [pv info cur state]
    puts $x

puts "executed test"

}

my_test

and has output:

{cur OK}
cur = 0.001
{cur OK}
executed test


References:
Channel Access and Tcl John Dobbins

Navigate by Date:
Prev: Channel Access and Tcl John Dobbins
Next: APS IT Maintenance Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Channel Access and Tcl John Dobbins
Next: APS IT Maintenance Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·