SPLat Logo

MODBUS Number Format

NOTICE: Our web site is being updated, but is currently experiencing extreme slowness due to host issues. Please contact us directly.
NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

MODBUS Number Format

MODBUS Master holding register commands allow the number format to be specified. 

The MODBUS standard says all registers must be 16 bits in length and must be in big endian format, meaning the first byte transmitted is the most significant byte.  This is also the lowest SPLat RAM location as internally SPLat is also big endian.

However some MODBUS slaves may use a different numbering format.  Floating point numbers are especially confusing because they are not officially part of the MODBUS standard, yet are widely used.  Specifying the Number Format value ensures the SPLat MODBUS Master will accept data from Slaves by other manufacturers.

ValueNumber Format
0 Byte
1 Word, big endian (standard)
Values below are only supported on 32 bit controllers (black boards)
2 Byte, little endian (non-standard)
3 Word, little endian (non-standard)
4 big endian IEEE float (ABCD)
5 big endian, byte swapped IEEE float (BADC)
6 little endian IEEE float (DCBA)
7 little endian, byte swapped IEEE float (CDAB)

Formats 0 and 1 are supported on all SPLat controllers.  However formats 2 thru 8 are only supported on SPLat 32 bit controllers (black boards).

The number format value is used in the following Script Commands:

SPLat floating point

SPLat floating point isn't IEEE.  For historical reasons, some bit positions have been shuffled.  Despite this you can still share SPLat floating point values with other controllers, here's the guide:

SPLat Master <-> SPLat Slave

If you want a SPLat MODBUS master and SPLat MODBUS slave to share floating point values, then treat them as 2 word registers.  The MODBUS protocol will correctly transfer all 32 bits that constitute the float value.

Foreign Master <-> SPLat Slave

On the SPLat slave, use the fWtoIEEE or fWtoIEEER pair when saving your float to memory.  This will put it into the format required by the foreign master.

SPLat Master <-> Foreign Slave

A) If you're using a SPLat 8 bit controller (green board), then MODBUS will be reading holding registers and placing the float into your master's memory in IEEE format.  You'll have to use the fIEEEtoW and fIEEEtoWR pair when reading the value from memory.  When sending values to the slave your application must use the fWtoIEEE or fWtoIEEER pair when savinf the floats to RAM.

Both these techniques will also work with the SPLat 32 bit controllers (black boards) but there's an easier method...

B) A SPLat 32 bit controller allows the float format to be specified in the number format field.  This means the value written to SPLat RAM will already be converted to SPLat format, so fRecallW & fRecallQ will work correctly.

 

MODBUS IEEE floating point

IEEE single precision 32 bit floating point format can be converted on the fly by with SPLat 32 bit controllers (black boards).

As floats are not officially supported by the MODBUS standard, everyone has implemented it differently.  SPLat MODBUS master supports all 4 methods.  To help clarify what each method means, we've used the letter ABCD where they mean this:

Remember floats are 32 bits, this being 2 MODBUS registers.  So using any of the floating point formats means your number of registers request must be an even number.