1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 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 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 <2015> 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: ai RVAL via asyn + modbus: getting unsigned integer |
From: | <[email protected]> |
To: | Mark Rivers <[email protected]> |
Cc: | "[email protected]" <[email protected]> |
Date: | Mon, 14 Dec 2015 14:45:02 -0800 |
Mark, that did fix the problem - changing nbits in INP asynMask from 16 (for unipolar) to -16 (for bipolar). Thanks so much! -- Jon PS - so now small negative input voltages result in small negative integer RVAL, with Vin -0.005 V: epics> dbgf Iso:GantryCouch:Collimator:Actual.RVAL DBR_LONG: -8 0xfffffff8 On Mon, 14 Dec 2015, Mark Rivers wrote:
I believe I may have found your problem. ... field(DTYP, "asynInt32") field(INP, "@asynMask(CollimCouch, $(OFFSET), 16, 1000)MODBUS_DATA") So you are using asynInt32 device support with the asynMask link syntax.This is the documentation from for asynInt32 and asynMask from http://cars9.uchicago.edu/software/epics/modbusDoc.html ...field(INP,"@asynMask(portName,offset,nbits,timeout)drvUser") .... nbits>0 for a unipolar device. For example, nbits=12 means unipolar 12-bit device, with a range of 0 to 4095. nbits<0 for a bipolar device. For example, nbits=-12 means bipolar 12-bit device, with a range of -2048 to 2047) ... So you have set nbits=16. But the documentation explains the nbits>0 is for unipolar devices. Yours is not a unipolar device, it is a bipolar device, so you should be setting nbits=-16. I believe that will fix your problem.