How to get a data type of REAL from PLC to robot?

  • In KRL, any SIGNAL variable is inherently a 32-bit signed integer, even if you declare it as smaller than 32 bits. There is no implicit means of putting a Real/Float value onto a SIGNAL.


    This is what the IEEE-732 standard is for. You can convert between the "real" floating-point value and an integer binary representation, and most PLCs do this automatically when programmed to send/receive a floating-point value over a bus connection. In KRL, you have to program the conversion yourself. These days, the CAST_TO and CAST_FROM functions work for it, Panic Mode has several examples in the forum archives.

  • Hi Panic, i am using cast_to and cast_from like your example at this page Click and all works like a charme.

    In my plc i use a 32bit real variable, i swap it for the endianess issue then i send to the robot by profinet.

    Robot side, i use it like your example (b2r() function) and all its ok.

    Is there any limitation using this method ? I haven't found any.

    Thanks a lot.

Advertising from our partners