Hi, I was wondering is it possible to convert a real number to a Integer number in Siemens Simatic s7 (so that the word can be read in Hex).
I've tried the following.
-Converted the Real Number to DI (Double Integer) using the Floor command.
- As the actual number was small I split the double Integer number i.e say DI Number was DB1.DBD100 but only used DB1.DBW102
- This DBW112 was then used in a calculation.
From Monitor Mode everything seems fine and I get the answer that I require. However from Monitoring the DB I get the Hex Format but in the FB Monitor I get the Dec format.
My problem is that I am sending this result down to a drive unit which only reads in the Hex format. The Format that is going down is the Decimal which the Drive unit interprets to be Hex and then gives a wrong result. Is there any way to ensure that the Hex number is sent or is it not possible due to the conversions that I have done previous. Appreciate anyones help. thanks
I've tried the following.
-Converted the Real Number to DI (Double Integer) using the Floor command.
- As the actual number was small I split the double Integer number i.e say DI Number was DB1.DBD100 but only used DB1.DBW102
- This DBW112 was then used in a calculation.
From Monitor Mode everything seems fine and I get the answer that I require. However from Monitoring the DB I get the Hex Format but in the FB Monitor I get the Dec format.
My problem is that I am sending this result down to a drive unit which only reads in the Hex format. The Format that is going down is the Decimal which the Drive unit interprets to be Hex and then gives a wrong result. Is there any way to ensure that the Hex number is sent or is it not possible due to the conversions that I have done previous. Appreciate anyones help. thanks