Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Siemens 300PLC, how to convert ASCII code into floating point number?
Siemens 300PLC, how to convert ASCII code into floating point number?
Firstly, according to byte, each character is converted into a number of 10. For example, the character' 3 '(ascii code value 3 is actually stored in PLC) is converted into the number 3 of 10, and then multiplied by the proportion according to the number of digits, and then added, in the form of 10 * A+B+0. 1 * C+0.

As for how to convert ascii code into binary data of 10, in fact, there is no need for special explanation in this case, because it is 0-9 ascii code, and the corresponding ascii code range is 48-57. You just need to subtract 48 directly from the address of DB 12. DBB7 obtains 10 binary data (of course, there is no arithmetic operation of byte data in step7).