transfer integer value between PLC and KRC4

  • hello all


    for my project I use a camera vision, a PLC Siemens 1515 and an KRC4 controller. I would like to transfer one value between a vision camera and an KRC4 controller. I configured mapping parameters between the PLC and the KRC4 controller. When I switch on the I/Os with the PLC I see the I/Os of KRC4 controller turn on to. but the problems is, I send an integer value by the PLC and I receive a booleans value in KRC4 controller. I would like to know if it is possible to send directly an integer value with the PLC and receive this same integer value in the KRC4 controller.


    thanks for your answer

  • How many bits per signal? Integer -- signed or unsigned?


    Siemens and KUKA use different byte ordering for multi-byte signals, look up "swapping" in the WorkVisual Help menu.


    In KRL, declaring a multi-bit Signal creates an Integer (unsigned unless it's 32bit) that is the direct integer conversion of the binary value on the $INs or $OUTs.

    Code
    DECL SIGNAL MySignal $IN[1] TO $IN[16]


    Will create a 16bit unsigned integer that is the base-10 value of the binary value on Inputs 1-16.

  • you can add the lane to your program in the declaration section.
    this will make this usable in that one program only.
    if you place the declaration in $CONFIG.DAT, that will make it global so any program can use it.

    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

  • Going by that screen shot, your camera may be using a different byte ordering than the KRC does. So when you group that I/O in WorkVisual, you may need to byte-swap them.


    As Panic says, you can place the SIGNAL declaration anywhere that KRL would accept a DECL for creating a variable, but what file or subroutine you declare it in will define it's "scope" of availability. Very briefly:
    1. Declared in a subroutine or function: Only available in that subroutine/function
    2. Declared in the .DAT file of a module: available to any subroutine/function in the .SRC file of that module, but not outside that module
    3. Declared in $CONFIG.DAT: available to any module in the robot
    4: Declared in a PUBLIC .DAT file other than $CONFIG.DAT, with a GLOBAL prefix: same as $CONFIG.DAT

  • thanks guys it works i can send the value and receive in my program


    I have an other question for you is not the same subject. Now i see the value in my program I want use it for change the trajectory of robot. Can you tell me who I can add the value of vision more the actual value of trajectory.


    Example I have : X = 10; Y = 20; Z = 30 and vision camera = 30 I add 30 in X so X = 40


    thanks

  • hello again


    I have one other question for you gays. I would like send an real value between TIA and KRC4 controller. I think I have to configure the IO mapping. So I trail to assemble 32 In KRC and 32 In profinet. But it dosen't work.


    I need help !!!! :help:

  • you need to be much more specific... what is "it" that does not work?



    just map 32-bit data to IO on the PLC side, map 32-bit data to IO on KRC side. test that data is transferred correctly by toggling bit by bit on PLC side (outputs) and record exact order they are turning on at the KRC side (input).
    order has to match so adjust it accordingly by modifying mapping on one of the ends. for example adjust IO mapping in WorkVisual by using byte swapping or individual bit mapping any way needed to get data sent from PLC appear in correct form at KRC. done...

    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

  • You declared an input, that is retentive as per definition (the task is to make it retentive on the other side). A different thing is a retentive output. Therefore you have to have some code in SPS.sub

  • Declare a global integer in config.dat, let's say

    Decl int value=0


    In the program when you want to set the output write:

    Value=101


    In SPS.sub in the loop section write

    MySignal=value


    Be aware that you will have a short time between setting value and mysignal.

  • 1. create another variable and make sure it is retentive. since you need to access it from SPS, this means it need to be a global variable and it must be initialized in the DAT file where it is declared.


    2. in the Submit keep copying (continuously) value of the output signal to this variable so whenever robot is powered down, last value is retained in the DAT file. so this need to be inside LOOP in the SPS.


    3. in the SPS, place line before LOOP to copy retained value from DAT file to the output signal. this way signal is updated only on powerup, not continously. your program (or variable monitor, or IO monitor) can be used to change the value as needed.

    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

  • I did use retained signal by using sps and it is working good.

    But The problem was robot was on coldstart, after making it on hibernate.. outputs are retaining as needed.😅

    Thank you guys for support.

Advertising from our partners