Author Topic: S7 1200 Modbus and Floating Point Numbers  (Read 1861 times)

Alpaslan

  • Newbie
  • *
  • Posts: 26
    • View Profile
S7 1200 Modbus and Floating Point Numbers
« on: October 14, 2020, 02:23:37 PM »
Hi,

Is there a good guy who knows how to implement floating point numbers in advancedHMI for s7-1200 with modbus driver?

I can read values in scientific notation however i want to use them like "123.45"

Within s7-1200; values are defined as Real that means these are floating point numbers.

Any kind of help is welcome.
Thanks.
One step at a time baby, One step at a time.

Alpaslan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: S7 1200 Modbus and Floating Point Numbers
« Reply #1 on: October 14, 2020, 02:57:43 PM »
Hi,

After i did some modifications, BasicLabel shows and enters real numbers to s7-1200.

What i did and result from Tia Portal (Please have a look to SwapBytes and SwapWords and i entered 5.3 to basiclabel which can be seen at un1_basinc2_set_hmi) :
« Last Edit: October 14, 2020, 03:00:09 PM by Alpaslan »
One step at a time baby, One step at a time.

Alpaslan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: S7 1200 Modbus and Floating Point Numbers
« Reply #2 on: October 15, 2020, 10:18:14 AM »
As result of today's experiments:

Cultural decimal point is a problem. You must use appropriate decimal point to your system. S7 uses "." as decimal point however this is not important. If your decimal point is "," then you must use ",". If you use wrong decimal point then number is written without decimal point. For example "85,96" is written as "8596" if you use wrong decimal point.
One step at a time baby, One step at a time.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: S7 1200 Modbus and Floating Point Numbers
« Reply #3 on: October 15, 2020, 02:29:28 PM »
You can always add code to behave the way you want, but then you can get into trouble is your PLC provides numeric data in a format like 1,234.67 which will get it complicated.