Experimental Physics and Industrial Control System
|
You need to specify the format conversion for a double, not for a float.
Change the format from %f to %lf and things should work.
Have a look at the scanf man mage for more details.
On Sep 15, 2007, at 9:01 PM, Szalata, Zenon M. wrote:
I have simple softIOC which reads values from a HP34401A
multimeter. The multimeter is connected via GPIB bus to NI PCI-
GPIB interface. The IOC is built with EPICS 3.14.9, ASYN 4-8, and
linux-gpib 3.2.09.
The command which reads the value is:
{&DSET_LI,GPIBREAD,IB_Q_HIGH,"READ?","%f",0,80,NULL,
0,0,NULL,NULL,NULL},
Caget shows something like: 1091779303, which is nonsence. The
value should be about 9.202. When I change the record to stringi,
then I see correct 9.2 type value. Also in edm I see the same
1091779303 unreal number. When I display it in hex, I see 0x41133AE7.
I also wrote a simple c program where:
int v=0x41133ae7;
float f;
memdpy( &f,&v,sizeof(int));
print( "0x%x %f\n",v,f);
This gives an output:
0x41133ae7 9.201880
All of this is on RHEL4 linux. It seems to me that EPICS is
interpreting the byte order in a way different than the c program.
But then what do I need to do to have the PV floating value be
correct? Thanks in advance,
Zen
--
Eric Norum <[email protected]>
Advanced Photon Source
Argonne National Laboratory
(630) 252-4793
- References:
- Byte Order? Szalata, Zenon M.
- Navigate by Date:
- Prev:
Byte Order? Szalata, Zenon M.
- Next:
Deadlock on epicsEvent Denison, PN (Peter)
- 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
- Navigate by Thread:
- Prev:
Byte Order? Szalata, Zenon M.
- Next:
lanGpibSupport-2.4.c Szalata, Zenon M.
- 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
|
ANJ, 10 Nov 2011 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|