Mapping KRC4 variables

  • Hi all,


    Here's my current configuration:


    KRC4 - 8.3.25
    EtherCAT - EL6695-1001
    WorkVisual - V5.0.5_Build0600
    EthernetKRL 2.2.6.140


    There are two questions I would appreciate your help with:


    1. Can the KRC4 Output DWORDs be mapped to REAL or is UDINT/DINT/DWORD the only options? By editing the signal at the provider, that was all I was able to achieve. [attached screenshot]


    2. Now working with the UDINT/DINT/DWORD data types, I am trying to read in $AXIS_ACT_MEAS.A1 that's an E6AXIS structure which is currently being read in as a 32bit UDINT value due to which I am (1) losing precision and (2) losing the sign. I am aware that the bit mapping needs to be done right. Does anyone have tested code that I can use for this data type conversion in KRL?


    I appreciate your help with this.

  • [size=2]unlike word data types (byte, int, dint...), REAL data type is encoded.[/size]


    [size=2]there is no built in way to transfer REAL data through I/O so may as well just mao the I/O any way you like (block of BOOL, or DINT or whatever) and write some KRL code. a while ago i shared couple of functions just for this kind of conversion, for example:[/size]


    [font=verdana, arial, helvetica, sans-serif][size=2]https://www.robot-forum.com/ro…c-kuka/msg70747/#msg70747[/size][/font]

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2


  • [size=2]unlike word data types (byte, int, dint...), REAL data type is encoded.[/size]


    [size=2]there is no built in way to transfer REAL data through I/O so may as well just mao the I/O any way you like (block of BOOL, or DINT or whatever) and write some KRL code. a while ago i shared couple of functions just for this kind of conversion, for example:[/size]


    [font=verdana, arial, helvetica, sans-serif][size=2]https://www.robot-forum.com/ro…c-kuka/msg70747/#msg70747[/size][/font]



    A great thumb up to you ,panic mode ! I cannot agree with you any more, but as a reminder ,the issue of big-little endian should be not ignored when IO mapping between robot and PLC/ other devices for DWORD/DINT ect. Thanks

  • The little/big-endian issue definitely matters, but we usually handle it at the I/O Mapping level. WorkVisual makes it easy, but you can also do it by swapping the mapping order of specific bytes in IOSYS.INI for KRC1s and KRC2s.


    It also bears noting that the CAST_TO and CAST_FROM functions in Panic's example performs IEEE-732 encoding of floating-point values, which (almost?) every PLC does natively, when connecting a floating-point value to an Input or Output block.
    It should also be noted that IEEE-732 requires 32 bits for each Real/floating-point value -- no more, no less. Transferring a lot of Real values over your FieldBus connection can eat up your I/O table pretty quickly, so it's a good thing that modern KRC2 support 4096 or even 8192-bit I/O table sizes.

Advertising from our partners