using BITS32 to send joint positions over EtherCAT fieldbus

  • Hello,


    I am writing a PC program that checks the robot joint positions every scan and sends it over EtherCAT to my PLC over a 32bit address. My robot is BX200L-A001 and my controller is E02. This is the snippet of code I am using inside an infinite WHILE loop:


    HERE #pose

    DECOMPOSE joints[0] = #pose

    @Temp = INT(joints[0]*1000) ; <--- This is giving me an error "(P0115) Illegal Function"

    BITS32 101, 32 = @Temp



    I am not using 16 bits to send the joint values since I want a precision of 3 decimals and also I have a 7th axis (positioner) that can have joint values in the thousands.


    Upon browsing here, I found a thread that says that BIT32 can only accept INTEGER values due to possibly a bug. For this reason, I am trying to convert the the REAL values from the "joints" array into integer and then passing that integer value to the BITS32 command. I am getting the "Illegal Function" error on the marked line above. I am assuming that the return type of the INT() function is still a REAL and not an INTEGER. How do I convert a REAL value in the joints array to an integer that can be passed to the BITS32 command?

  • HawkME

    Approved the thread.
  • What was mentioned in that thread about a 'bug' was a loose statement I made without cause.


    I am pretty sure converting real to whole number may not be possible.

    Even though the real can be changed to an integer value via INT command, I am 100% sure it still remains as a real variable and cannot be transferred to a whole number to be used as @.


    A BX200 and you require 3 decimal places....... :hmmm:

    Strange you would need to monitor for that accuracy as the repeatable accuracy for that robot will never sit in a 3 decimal place arena.


    Anyway, like I mentioned, I don't think there is a solution for converting a real number to whole number in Kawasaki.


    I would contact Kawasaki directly for this and see if they do have a solution available.

  • I have a code example for sending 32-bits numbers, but you should know that it will be correct only for the first 7 digits. (According to the manual)


  • I have a code example for sending 32-bits numbers, but you should know that it will be correct only for the first 7 digits. (According to the manual)


    Thank you so much for this code! I will try and run it today on the robot!

  • Ahh my apologies for the "bug" statement.


    The reason why I want to have a 3 decimal accuracy is because I want to replicate the position of the robot in our custom software. Even if I lower my resolution to 2 decimal places, the question of JT7 axis still remains because for a linear track of 10m, the max position is 10000.0 mm. So 16 bits would not be sufficient in the future should a customer decide to purchase a robot with 10m track.

Advertising from our partners