Problem Reading Swapped Byte Float Data

Hi,
We have L&T's Series 4000 Energy Meters wherein the Data is available in Float Data Type with Swapped Byte. We have Tried using FloatMode = 1 in Modbus Parameters and We need to read data from 2 registers 40159 & 40160 the Variable type created is Real still we are unable to get the data which otherwise is easily available on ModScan and other such softwares.
Software Version Vijeo Citect 2018
Parents
  • There are several Serial Modbus Drivers, and which one is the right one is not always logical. However the first problem I see in the addressing. I believe most Citect modbus drivers read 32 bit registers by combining 2 16 bit registers. I don't believe citect can scan 40159 and 40160 in consecutive 32 bit values. It should be 40159 and 40161 or 40158 and 40160. My experience with modbus RTU is limited to a few brands so I could be wrong. If your device has individual 32 bit registers at 159 and 160, citect still reads each part of the 32 register as 2 16's, values from your device would be seen by citect as shown in this example

    Device Citect
    0 0
    0 1
    1 2
    1 3
    2 4
    2 5

    So to capture register 1 from your device you would put address 2 in citect and to capture reg 2 you would use reg 4.

    the exact register numbers, how they start how they end would depend on which driver your using.

    I hope this helps

  • Having addresses offset by 1 is a common Modbus problem. There are different mode numbers in the Citect MODBUS driver to correct for that. See the help page: MODBUS Driver > Non-standard Devices > Protocol variants

    However, I have never seen a device where each Modbus address referred to 32 bits. The Modbus standard requires every address to represent 16 bits. So, if you store a 32-bit long integer or floating point value, it must take up 2 16-bit registers, like 40159 and 40160. In Citect you would create a tag with the address 40159, and use a 32-bit data type, like LONG, ULONG, or REAL, which forces it to read the second register (40160) as well. Some devices will have their own internal addressing (which could go by 32-bit registers), but they normally give you a Modbus address translation table.

    You can check if the [MODBUS] FloatMode parameter is working. Check what value is displayed in Citect, then change the FloatMode value and restart the runtime. You should see a different value displayed for each float mode. If you don't see different tag values in the runtime, then there may be a typo in the citect.ini parameter. Make sure you're saving the parameter in citect.ini, not in the Project Parameters table...some drivers don't work with that.

    I don't have a serial device handy, so I tested with ModSim and ModScan using Modbus TCP. I verified that if you can read the float in ModScan as "Floating Pt", then you would need FloatMode=0 in Citect. If ModScan reads the value as "Swapped FP", then in Citect you would use FloatMode=1.

  • Yes, I also have never seen a device that didn’t use 2 16 but registers for floating points. The problem I saw with your question is that you are reading 159 and 160 as separate 32 bit registers. This is not possible it will alway be evens or odds. To test your comms try tagging the first real(either 0 or 1) once you get that working you can figure out the higher number registers.

Reply
  • Yes, I also have never seen a device that didn’t use 2 16 but registers for floating points. The problem I saw with your question is that you are reading 159 and 160 as separate 32 bit registers. This is not possible it will alway be evens or odds. To test your comms try tagging the first real(either 0 or 1) once you get that working you can figure out the higher number registers.

Children
No Data