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: bit shifting operators |
From: | Florian Feldbauer <[email protected]> |
To: | "[email protected]" <[email protected]>, [email protected] |
Date: | Tue, 28 Jun 2016 12:57:25 +0200 |
Hey, you could use a CALC record to get the individual fields of the 16-bit value.I'm using a similar ADC where bit 15 is an ALERT-flag, bits 14-12 code the channel, and bits 11-0 hold the conversion result. For accessing these three values I'm using: record( longin, "AD7998:$(ID):CONVERSION:RESULT__" ) { field( DTYP, "stream" ) field( INP, "@ad7998.proto rConv($(ID)) I2C" ) field( FLNK, "AD7998:$(ID):CONVERSION:RESULT:SPLIT__" ) } record( calc, "AD7998:$(ID):CONVERSION:RESULT:SPLIT__" ) { field( INPA, "AD7998:$(ID):CONVERSION:RESULT__ NPP NMS" ) field( CALC, "b := (( A & 32768 ) >> 15 ); c := (( A & 28672 ) >> 12 ); ( A & 4095 )" ) field( FLNK, "AD7998:$(ID):CONVERSION:FANOUT__" ) } Field B of the CALC records contains the alert flag, field C the channel number and VAL the actual conversion result. Hope that helps. Cheers, Florian On 06/28/2016 11:30 AM,
[email protected] wrote:
-- ---------------------------------------- | Dr. Florian Feldbauer | | | | Helmholtz-Institut Mainz / | | Johannes Gutenberg-Universität Mainz | | Johann-Joachim-Becher-Weg 36 | | D-55128 Mainz | | | | Office: SB1 / 00-213 | | Phone: (+49)6131 / 39-29608 | ---------------------------------------- |