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 2025 | 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 2025 |
<== 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: | Thu, 3 Dec 2015 10:16:48 -0800 (PST) |
On Thu, 3 Dec 2015, Mark Rivers wrote:
Hi Jon,
http://cars9.uchicago.edu/software/epics/modbusDoc.html Supported Modbus data types modbusDataType value drvUser field Description 0 UINT16 Unsigned 16-bit binary integers ... 4 INT16 16-bit signed (2's complement) integers. This data type extends the sign bit when converting to epicsInt32. ... So modbusDataType=0 is UINT16, unsigned 16-bit integer. That explains your problem, you should be using modbusDataType=4 (INT16) and your command line should be: drvModbusAsynConfigure("CollimCouch", "AcromagCollimCouch",0,4,0,9,4,100,"AcromagXT1221")
That must be it. The referenced documentation is for Modbus release 2-7 and we are still running 2-2, which only supports data type codes 0 - 3. When we try code 4 in 2-2, RVAL is always 0. The 2-2 doc says:
Type 0 is used for binary numbers in twos-complement format. The data can either be signed or unsigned. But, as we found, it isn't very helpful for signed integers. Thanks for clearing this up. Jon Jacky