EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: EPICS problem
From: Andrew Johnson <[email protected]>
To: Mark Rivers <[email protected]>
Cc: [email protected]
Date: Thu, 09 Dec 2004 10:31:17 -0600
Hi Mark,

Mark Rivers wrote:

So the IOC is reporting that it set field_type and dbr_field_type to 4, which is DBF_USHORT according to dbFldTypes.h. But cainfo is reporting that the field type is DBR_LONG. Why?

So the IOC is setting the field types to 6, which is DBF_ULONG, as
expected.
But cainfo is reporting that the field type is DBF_DOUBLE.  Why?

The problem is not with the cainfo, all channel access clients are
reporting the same thing.

This is intentional behaviour, and applies to all CA transfers, not just arrays. The reason for the difference is related to numeric conversions and the different DBF_ field types that are available via dbAccess.h (as used by database code) and db_access.h (as used by Channel Access).


The full range of values that may appear in a DBF_USHORT (available to database code via dbAccess.h ) cannot be represented in a DBF_SHORT, the 16-bit type available in db_access.h; there are no unsigned types in db_access.h. CA has to convert your DBF_USHORT values into DBF_LONG in order to guarantee that it can transparently transmit all possible field values to the CA client. Similarly, the only db_access.h type that can hold all possible values from a dbAccess.h DBF_ULONG is a DBF_DOUBLE.

If you don't want CA doing those conversions behind your back, you should avoid using unsigned types for record fields, and define them as DBF_SHORT and DBF_LONG instead.

HTH,

- Andrew
--
Dear God, I didn't think orange went with purple until I saw
the sunset you made last night.  That was really cool. - Caro


References:
EPICS problem Mark Rivers

Navigate by Date:
Prev: RE: Initial value readback from hardware into output records Ralph Lange
Next: Re: Initial value readback from hardware into output records Russell Redman
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EPICS problem Mark Rivers
Next: Is anybody investigating using state-full web services with EPICS APIs? Bill St. Arnaud
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·