EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  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  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: MEDM enum not displaying correctly?
From: Benjamin Franksen <[email protected]>
To: [email protected]
Date: Tue, 17 Jul 2007 22:35:22 +0200
On Tuesday 17 July 2007 09:14, Heinrich du Toit wrote:
> I have a custom record with a ENUM field.
> This field has 100's of possible options.
> My get_enum_str function is implemented.
> But I don't have get_enum_strs or put_enum_str cause this is a read-only
> field and MEDM can only get 16 options so it wouldn't matter.

Yes that's one of the static size limits in EPICS. Unfortunately it is also 
hardcoded into CA which is yet another reason for your problems...

> Now if I setup a text monitor for the field I only get the
> decimal(integer) value?
> If I use the PV Info option it says Value = the string I want.
>
> How do I get medm to display this string in the text monitor?

MEDM, like many (but not all) CA client apps, requests data in the CA 
server's "native" type (to minimize IOC and network load) which in your 
case would be enum which is represented as a 16 bit integral value. 
Conversion to a string needs the table that associates numbers with 
strings, but CA allows only 16 values here. Bummer.

The work-around for the CA limit is to create a stringin record with INP set 
to monitor the enum field and then reference this stringin in your MEDM 
display. This works because the stringin record requests the data as 
string. 

This, however, is not the end of the story. Next, you need to take care that 
your record support is able to correctly answer a string request for the 
field in question. As you found out it is not possible to use the built-in 
conversion support because it is limited, albeit to 30 items, not 16, at 
least since 3.14.

Anyway, it should be possible to work around this issue, too, by making the 
field special(SPC_DBADDR) in the dbd and adding an appropriate cvt_dbaddr 
method to the record support. This method is called prior to the request 
and can change all the values of the DB_ADDR that it receives. So, whenever 
you get a request of type DBR_STRING, just change the field pointer of the 
structure to point to the correct string in you string table.

If you think all this is far from being obvious, well I couldn't agree more.

Cheers
Ben

Replies:
Re: MEDM enum not displaying correctly? Benjamin Franksen
References:
MEDM enum not displaying correctly? Heinrich du Toit

Navigate by Date:
Prev: Re: Asyn 4.8 compile error with Linux GPIB Janet Anderson
Next: RE: Asyn 4.8 compile error with Linux GPIB Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: MEDM enum not displaying correctly? Heinrich du Toit
Next: Re: MEDM enum not displaying correctly? Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·