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: Re: Re: A problem with modbus reading floating point numbers |
From: | Mark L Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | 高振华 <gaozh at ihep.ac.cn> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Fri, 19 Nov 2021 13:21:02 +0000 |
> 1. Does the modbus enumeration type start at 0 or 1? Rval is also incorrect when we try to set modbus data type to 0x8.
It starts at 0. However, if you use R3-2 of the modbus module then you can replace 0x7 with the string INT32_BE. This is much
easier to understand. I recommend that you use that version.
But I am still confused about what you are saying. You said:
>
note: I used the AI_scaledValue command to read moxa E1242 instead of the raw AI_rawValue command.
> Instead of reading the original 2-byte integer, the 4-byte float value converted to the scaled value is read .
If this is really true then you should not be using INT32_BE you should be using FLOAT32_BE
(or one of the other FLOAT32 variants).
> AsynFloat32
type not found, Only asynFloat32Array was found,Can I use it to read 4-byte float values?
No. You should use asynFloat64, not asynFloat32.
The driver will convert the value from Float32 to Float64. That is explained in the documentation here:
Mark
From: 高振华 <gaozh at ihep.ac.cn>
Sent: Friday, November 19, 2021 2:43 AM To: Mark L Rivers <rivers at cars.uchicago.edu> Cc: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Re: Re: Re: A problem with modbus reading floating point numbers Thank you very much,mark.
But I have some questions about modbus datatypes and ASyn interface types: 1. Does the modbus enumeration type start at 0 or 1? Rval is also incorrect when we try to set modbus data type to 0x8. drvModbusAsynConfigure("MOXA_E1242_In_Word", "moxa", 255, 4, 0x208, 0x8, 0x8, 2000, "moxa E1242") 2. AsynFloat32 type not found, Only asynFloat32Array was found,Can I use it to read 4-byte float values? Rval is also incorrect when trying to set DTYP to asynFloat32Array. record(ai, "$(P)$(R)_AI") { field(DTYP,"asynFloat32Array") field(INP,"@asynMask($(PORT) $(OFFSET) $(BITS))MODBUS_DATA") field(LINR,"LINEAR") field(EGUL,"$(EGUL)") field(EGUF,"$(EGUF)") field(HOPR,"$(EGUF)") field(LOPR,"$(EGUL)") field(PREC,"$(PREC)") field(SCAN,"$(SCAN)") } -----原始邮件----- -- 祝好!
高振华
电话:010-88235426
Email:gaozh at ihep.ac.cn
|