RobotStudio event

Real Values in Rapid

Hope the best of all!
is it possible to set real values as a global variable in IRC5 Rapid language like (speed/position) of an AC Servo and control the servo from IRC5 pendant.
I mean digital signals can be defined and can be used to map the PLC IO bits that makes servo on/off (servo is controlled using Siemens PLC), but to control the speed and position of ac servo from IRC5 pendant. can we define global variables to enter the values in pendant (rapid program) the motion speed and position. 
any hint pleaseee

Answers

  • lemster68
    lemster68 ✭✭✭
    Map group outputs to the PLC for position and speed.
    Lee Justice
  • soup
    soup ✭✭✭
    Yes, single bit signals can be made for on/off (0/1), but you can also make group and analog input signals for larger numeric values.
  • BiteBytesButes
    edited January 5
    All,
    Please:
    Regarding the size of this GI, can it to be 32 bit? I mean, if I am using form the PLC side SINT, should I use 4x SINT for 32 bit in the EOI?  My doubt is with what IRC5 (my case is with an Omnicore E10) will see trough the EOI to be able to read REAL values (32 bit) sent out from the PLC.
  • Hi !

    Do I understand correctly, that you would like to use 32-bit IEEE-754 floating point on PLC side and  decimal numeric in ABB side?

    You can not use them directly as bitwise those are different datatypes. But you can write own functions to convert between them.

        !##########################################
        ! Convert group 32 bits to float32 value
        FUNC num Float32ToNum_Ext(dnum Bits, INOUT bool IsNaN, INOUT bool IsNegInfinity, INOUT bool IsPosInfinity)
            VAR rawbytes rawData;
            VAR num result;        
        ...
        do NaN and Infinity testing here
        ...
                
                ! pack 4 bytes into raw data without change in format
                PackRawBytes Bits, rawData, (RawBytesLen(rawData) + 1) \IntX := 4;            
                ! read out 4 bytes using float format conversion
                UnpackRawBytes rawData, 1, result, \Float4;
            RETURN result;
        ...
        do error handling here
        ...
        ENDFUNC


        !##########################################
        ! Encode decimal number to 32 bits IEEE754 floating point format
        FUNC dnum NumToFloat32(num Decimal, \switch SetNaN, \switch SetNegInfinity \switch SetPosInfinity)
            VAR dnum result;
            VAR rawbytes rawData;        
        ...
        do NaN and Infinity encoding here
        ...
            
            ! pack decimal into raw data using 4-byte Float format conversion
            PackRawBytes Decimal, rawData,(RawBytesLen(rawData) + 1) \Float4;        
            ! and read 4 bytes of packed data out again into DNum without changing format
            UnpackRawBytes rawData, 1, result, \IntX := 4;
            RETURN result;
        ...
        do error handling here
        ...        
        ENDFUNC

    Have fun!
    Fritz.
  • Hi Fritz,
    Very clear...
    appreciated!...I will try!