Let us know
Reading MODBUS function 23 and apply IEEE754 conversion

This topic is about reading MODBUS function 23 which is not possible using direct syntax of dataTaker. This is related to Mastervolt Mass battery charger : https://www.mastervolt.com/products/mass-24v/mass-24-25-2-230v/

There are several requirement prior of MODBUS reading:

  • you will need to do the reading using SERIAL syntax rather than MODBUS syntax
  • you will need to know MODBUS polling sequence in hexadecimal, this can be obtained by interrogating the sensor using MODBUS Client software (i.e.: MODBUS Poll, ComTest)
  • the purpose is knowing hexadecimal sequence to be replicated as dataTaker serial syntax on one target parameter
  • you will need to locate the data portion within hexadecimal sequence
  • you will need Mastervolt software to check and compare MODBUS data response
  • make sure serial port setting as a match to Mastervolt device
  • check Mastervolt device address

For example:
Getting battery voltage as seen in MasterAdjust software
5dd5c997cbf43

I will not go to detail in determining the hexadecimal sequence,
the required sequence as snooped from MODBUS Client software:

Tx:01 17 00 00 00 06 00 00 00 06 0C 0A 02 97 11 00 00 00 0E 00 00 00 00 5A 59
Rx:01 17 0C 0A 02 97 11 00 00 00 0E 2C AC D4 41 DD 73

Within Rx sequence the last 6 byte are data (2C AC D4 41 - 4 byte) and CRC (DD 73). We need to focus on data portion and will make conversion of this data.

In dataTaker serial syntax, the portion for polling will follow Tx hexadecimal sequence represented in ASCII:

1SERIAL("{\001\023\000\000\000\006\000\000\000\006\012\010\002\151\017\000\000\000\014\000\000\128\063\123\137}",W)

While within parsing of sensor response, each byte from MSB to LSB are hosted to 4CV, 3CV, 2CV and 1CV.

1SERIAL("%*11b%1b[4CV]%1b[3CV]%1b[2CV]%1b[1CV]\e",W)

Later on we can utilize dataTaker script which replicate IEEE754 formula to convert 4 byte hexadecimal number into floating points:

5CV("Sign Bit",W)=(-1*(1CV>127.5))+(1CV<127.5)        
IF(1CV>127.5){1CV(W)=1CV-128}

6CV("Exp Low Bit",W)=2CV>127.5        
IF(2CV>127.5){2CV(W)=2CV-128}

10CV("Exponent bias",W)=((1CV*2)+6CV)
7CV("Exponent",W)=((1CV*2)+6CV)-127    

8CV("Bin Frac",FF7,W)=(2CV/(2^7))+(3CV/(2^15))+(4CV/(2^23))
IF(8CV<1){8CV(W)=18CV+1}                                

9CV("Number",W)=5CV*(2^7CV)*8CV

The final number (already as flowing point) is located on 9CV.

Best regards,
Rudy Gunawan

This topic is about reading MODBUS function 23 which is not possible using direct syntax of dataTaker. This is related to Mastervolt Mass battery charger : https://www.mastervolt.com/products/mass-24v/mass-24-25-2-230v/ There are several requirement prior of MODBUS reading: - you will need to do the reading using SERIAL syntax rather than MODBUS syntax - you will need to know MODBUS polling sequence in hexadecimal, this can be obtained by interrogating the sensor using MODBUS Client software (i.e.: MODBUS Poll, ComTest) - the purpose is knowing hexadecimal sequence to be replicated as dataTaker serial syntax on one target parameter - you will need to locate the data portion within hexadecimal sequence - you will need Mastervolt software to check and compare MODBUS data response - make sure serial port setting as a match to Mastervolt device - check Mastervolt device address For example: Getting battery voltage as seen in MasterAdjust software ![5dd5c997cbf43](serve/attachment&amp;path=5dd5c997cbf43) I will not go to detail in determining the hexadecimal sequence, the required sequence as snooped from MODBUS Client software: ```` Tx:01 17 00 00 00 06 00 00 00 06 0C 0A 02 97 11 00 00 00 0E 00 00 00 00 5A 59 Rx:01 17 0C 0A 02 97 11 00 00 00 0E 2C AC D4 41 DD 73 ```` Within Rx sequence the last 6 byte are data (2C AC D4 41 - 4 byte) and CRC (DD 73). We need to focus on data portion and will make conversion of this data. In dataTaker serial syntax, the portion for polling will follow Tx hexadecimal sequence represented in ASCII: ```` 1SERIAL(&quot;{\001\023\000\000\000\006\000\000\000\006\012\010\002\151\017\000\000\000\014\000\000\128\063\123\137}&quot;,W) ```` While within parsing of sensor response, each byte from MSB to LSB are hosted to 4CV, 3CV, 2CV and 1CV. ```` 1SERIAL(&quot;%*11b%1b[4CV]%1b[3CV]%1b[2CV]%1b[1CV]\e&quot;,W) ```` Later on we can utilize dataTaker script which replicate IEEE754 formula to convert 4 byte hexadecimal number into floating points: ```` 5CV(&quot;Sign Bit&quot;,W)=(-1*(1CV&gt;127.5))+(1CV&lt;127.5) IF(1CV&gt;127.5){1CV(W)=1CV-128} 6CV(&quot;Exp Low Bit&quot;,W)=2CV&gt;127.5 IF(2CV&gt;127.5){2CV(W)=2CV-128} 10CV(&quot;Exponent bias&quot;,W)=((1CV*2)+6CV) 7CV(&quot;Exponent&quot;,W)=((1CV*2)+6CV)-127 8CV(&quot;Bin Frac&quot;,FF7,W)=(2CV/(2^7))+(3CV/(2^15))+(4CV/(2^23)) IF(8CV&lt;1){8CV(W)=18CV+1} 9CV(&quot;Number&quot;,W)=5CV*(2^7CV)*8CV ```` The final number (already as flowing point) is located on 9CV. Best regards, Rudy Gunawan
edited Nov 20 '19 at 11:17 pm
76
0
1
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft