AdvancedHMI Software

General Category => Open Discussion => Topic started by: Alpaslan on October 14, 2020, 02:23:37 PM

Title: S7 1200 Modbus and Floating Point Numbers
Post by: Alpaslan 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.
Title: Re: S7 1200 Modbus and Floating Point Numbers
Post by: Alpaslan 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) :
Title: Re: S7 1200 Modbus and Floating Point Numbers
Post by: Alpaslan 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.
Title: Re: S7 1200 Modbus and Floating Point Numbers
Post by: Noe 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.