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: 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: | Thu, 18 Nov 2021 13:32:55 +0000 |
>
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 .
So the Moxa is returning a
4-byte float, or is it returning an integer?
The drvModbusAsynConfigure
command is this:
drvModbusAsynConfigure("MOXA_E1242_In_Word",
"moxa", 255, 4, 0x208, 0x8, 0x7, 2000, "moxa E1242")
So you are using Modbus data
type 0x7 which is INT32_BE. So the driver is reading a 32-bit integer, not a 32-bit float.
Your ai record is configured
for asynInt32 device support:
field(DTYP,"asynInt32")
If
the Moxa is returning a float you need to change both the Modbus data type and the asyn interface in the ai record.
Mark
From: 高振华 <gaozh at ihep.ac.cn>
Sent: Thursday, November 18, 2021 2:29 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: A problem with modbus reading floating point numbers Hi Mark, Now rval=7 instead of 49169 for 7.5V. epics> dbpr MOXA:ADC1_AI 2 ACKS: NO_ALARM ACKT: YES ADEL: 0 AFTC: 0 AOFF: 0 ASG : ASLO: 1 BKPT: 00 DESC: DISA: 0 DISP: 0 DISS: NO_ALARM DISV: 1 DTYP: asynInt32 EGU : EGUF: 65535 EGUL: 0 EOFF: 0 ESLO: 1 EVNT: FLNK: CONSTANT HHSV: NO_ALARM HIGH: 0 HIHI: 0 HOPR: 65535 HSV : NO_ALARM HYST: 0 INP : INST_IO @asynMask(MOXA_E1242_In_Word 0 16)MODBUS_DATA LCNT: 0 LINR: LINEAR LLSV: NO_ALARM LOLO: 0 LOPR: 0 LOW : 0 LSV : NO_ALARM MDEL: 0 NAME: MOXA:ADC1_AI NSEV: NO_ALARM NSTA: NO_ALARM PACT: 0 PHAS: 0 PINI: NO PREC: 3 PRIO: LOW PUTF: 0 ROFF: 0 RPRO: 0 RVAL: 7 SCAN: I/O Intr SDIS: CONSTANT SDLY: -1 SEVR: NO_ALARM SIML: CONSTANT SIMM: NO SIMS: NO_ALARM SIOL: CONSTANT SMOO: 0 SSCN: <nil> STAT: NO_ALARM SVAL: 0 TIME: 2021-11-18 15:14:56.279766515 TPRO: 0 TSE : 0 TSEL: CONSTANT UDF : 0 UDFS: INVALID VAL : 7 epics> #traceIO 2021/11/18 15:50:06.322 192.168.127.254:502 write 12 00 99 00 00 00 06 ff 04 02 00 00 04 2021/11/18 15:50:06.339 192.168.127.254:502 read 17 00 99 00 00 00 0b ff 04 08 c0 11 00 00 00 0f 00 26 2021/11/18 15:50:06.340 192.168.127.254:502 write 12 00 9a 00 00 00 06 ff 04 02 08 00 08 2021/11/18 15:50:06.355 192.168.127.254:502 read 25 00 9a 00 00 00 13 ff 04 10 16 30 40 f0 00 00 00 00 00 96 3b 16 00 be 3b be -----原始邮件----- -- 祝好!
高振华
电话:010-88235426
Email:gaozh at ihep.ac.cn
|