EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: bit shifting operators
From: "[email protected]" <[email protected]>
To: [email protected]
Date: Tue, 28 Jun 2016 11:30:01 +0200
Hello,
I am trying to read the voltag from an 8-channel adc via I2C.
 
My result is a 16 bit value (for example 0010 0000 0010 0000). The bits15-12 "0010" respresent the channel (Ch1=0, CH2=1, CH3=2 ....). 
 
I can get the channel value with a SHFT-field:
record( longin, "ADC:RESULT" ) {
  field( DTYP, "stream" )
  field( INP,  "@adc.proto readReg($(ID)) I2C" )
}
record( mbbiDirect, "ADC:RESULT:CHANNEL" ) {
  field( DTYP, "Raw Soft Channel" )
  field( INP,  "ADC:RESULT.VAL")
  field(SHFT, "12")
}
 
Now I want to get the first bits 0-12 and convert the value to voltage-value. To convert this value I use the "ASLO"-field.
But I don't know which is the best way to get the value of the first 12 bits.
 
Thanks,
Raul

Replies:
Re: bit shifting operators Florian Feldbauer

Navigate by Date:
Prev: Compiling EPICS 3.14.12.5 with GCC 6 Luca Cavalli
Next: Re: bit shifting operators Florian Feldbauer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Compiling EPICS 3.14.12.5 with GCC 6 Hill, Jeff
Next: Re: bit shifting operators Florian Feldbauer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·