KRL to KAREL match cases

  • Dear all,

    I have a requirement to implement the Kuka functions on Fanuc. I am trying to quickly handle both the languages, but the most hard are the fundamental syntax differences. I would highly appreciate if you can give me some tips with matches between these 2 languages. The more questions will come, but the first pit-stone i have faced is the following:

    I take CMD as an input of the function, then:






    IF Product_activated AND NOT V_DISABLE[SYS] THEN





    How exactly CMD is working? It compare the CMD value with ENUM #MY_INIT, but where from CMD values are defined? One of the states of my MY_INIT is _INSP, but from KUKA documentation CMD has only certain states.

    What is the similar to CMD value applied on Fanuc? If there is no any what is the possible work around?

    Thanks in advance!

  • AD
  • Guys, sorry mb some questions are really silly, but still you can save me plenty of time.

    Below is the KUKA line. How can i do the similar mapping on Fanuc.


    Shall i do it as a Group Signal? As far as i understand Group signals on Fanuc do not have the 'Names' or is there some other way to name them?

    Another question is , is there any similar to Kukas VARSTATE("Arr") == #INITIALIZED command on Fanuc?

  • Ok, please just some comments to these line, how can i do the similar on FANUC? There are group signals, but can use them to write directly into DOUT areas or not?


  • Unfortunately I don't know the KUKA side at all, so I can only help out on the Fanuc side.

    Group outputs are always mapped to digital outputs. You have to define the mapping manually via the IO screen, and then reboot the robot. You could write directly to the digital outputs. The group output is more for human readability.

    If you set a number to the group output, the corresponding bits will be set. There is no way no name outputs (beyond a comment) in Fanuc world.

    That code you have would probably be something like this in a Fanuc controller:

    GO[1]=(R[10:Measurement]) ;

    Check out the Fanuc position converter I wrote here!

  • Thanks Nation!

    GO[1]=(R[10:Measurement]) ; - does it asign group trigger to the register?

    I am working via pc. file. I have tried basically both set group signal manually and in Karel. Still when i give some value i do not see any change on Digital Outputs.

    Regarding KUKA what it does below , in KRL there is a Data type which allows to assign the Signals area to some variable. All i found similar on the Karel documentation is the Group signal.


  • Can you explain in generic terms what you are trying to do. I don't know what any of that kuka code means. What type of data are you trying to work with, boolean, integer, real? Are you trying to set data internally or communicate to another device?

  • The application will communicate with the other device. Sorry, initially the problem was that for Kuka the procedure to work with the Group signals is way easier and on Fanuc it took time to figure out how to work with that.

    Now the issue is still that i need to assign some 32 bits signals to the Output areas, for Fanuc i have found the following options, but i cannot get how can i set it?

    io_gpin32 = 37 -- Grouped inputs 32 bits

    io_gpout32 = 38 -- Grouped outputs 32 bits

  • First you have to decide what communication protocol you are going to use. 24v IO, EthernetIP, Profinet, Sockets, etc. Then you select 32 consecutive points on that IO slot and configure them to either Digital IO or Group IO. Group IO has a max of 16, so you would need 2 of them. Or you could use 32 Digital.

    Configuration is done through the IO menu. You don't use code to map it, it is menu driven.

    So now tell us which communication method you are going to use and we can then help you.

  • io_gpin32 = 37 -- Grouped inputs 32 bits

    io_gpout32 = 38 -- Grouped outputs 32 bits

    You found the constants that defined in the kliotyps file. They are used with the SET_PORT_ASG command in Karel. After some testing, I feel like they may be for future use, and not implemented.

    However, I don't think it is possible to map a GO to 32 bits. I've been trying in a V8.3 controller, and it just deletes the map if it over 16 bits. You may have to use 2 16bit groups.

    Check out the Fanuc position converter I wrote here!

  • KUKAs don't have GOs and GIs, just a huge array of $INs and $OUTs, which are, effectively, the same as a Fanuc's DIs and DOs.

    (the analog I/Os are a bit different, but I'm ignoring those)

    Now, I'm weak on Fanucs, but I've only ever seen GIs and GOs set up in the I/O Config menus.

    But, in KRL, "group signals" are created in program modules, not in the system config. So, the line

    SIGNAL SignalName $OUT[1] TO $OUT[8]

    Creates a "group output" at the program level. SignalName would be a "handle" that the KRL program treats as an Integer variable, and assigning any value 0-255 to that variable would automatically cause the binary equivalent to be output on "DOs" 1-8.

    So, what I think OP wants to know is, in KAREL, can he create/assign a Name to a GO/GI, so that instead of GO[1] = 55 (and trying to remember what GO 1 is), he could program SignalName=55.

    I've never done KAREL. I know you can add a "comment" to DIs, DOs, GIs, GOs, and Rs and PRs in the Data screen, and those comments show up (usually) in TP programs when you use those signals/registers, but I'm not sure how that carries through to KAREL.

    GO[1]=(R[10:Measurement]) ; - does it asign group trigger to the register?

    No trigger. That's a TP command (not KAREL) that simply pushes the contents of Register 10 to Group Output 1.

    TP doesn't (AFAIK) let you create variables, so you're stuck using Registers. Registers in TP are... well, from a KUKA standpoint, imagine them as an array of REAL variables declared in $CONFIG.DAT, so they're inherently Global. Except you have a fixed number of them, and can't create more, the way you could in KRL.

    The "Measurement" name shown in your example is just a "comment" attached to Register 10, it has no programmatic significance that I'm aware of. KRL doesn't really have an equivalent -- the closest match would be the "long text" names you can assign to I/Os, which only effect the user-interface display, but have no effect on the KRL program at all.

  • HawkME in the requirements is stated that the tech package should support various Communication standards (ProfiNet, DeviceNet,Profinet,Ethernet/IP).

    I am trying to configure the program to process the same I/O as it is done for the Kuka on the master example.

    What type of data are you trying to work with, boolean, integer, real? Are you trying to set data internally or communicate to another device?

    All the values are transacted via Booleans, those it can be applied to any protocol.

    Nation, Ja i have faced the same. I cannot configure the port to work with the 32 bits, in spite of it is mentioned on the documentation.

  • Ok, well all you will need to break it up into either two 16 bit group outputs or 32 digital outputs. You can choose any that are available and add descriptions for them. To actually see it working in the program you first have to select a communication protocol to use. If you don't know that yet then you could temporarily use the internal memory port for testing purposes.

    To assign a group output to internal memory port go to menu>IO>Type>Group>Out>Config

    Then for example if you want GO[1] and GO[2] you would set them as shown:


    Later on when you determine what communication protocol that you actually want to use you would need to change the rack/slot/start assignment accordingly. You can now simply set the integer value of the group outputs in your code. If instead you would like to set it each of the 32 bits individually you would need to use DO's using a similar configuration process.

  • HawkME , Thanks!

    I am setting the ports via .kl:

    FOR GIN:





    Still to configure 32 bits i didnt find any successful configure. It just resets the port configuration.

    I would in general assume something like that:


    Another question is regarding calls procedure. My expectation was that after i will declare my functions in .kl file (pc. after uploading). I will be able to call them from the tp. programs as a function STARTPRODUCT ( 1,2 ).

    Now i have faced that even to call it from the different pc program i ll need to define them via FROM.

    How should be it organized properly? How will my kl. functions interact with ls. programms?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now