Bit/Byte/word convert to integer value

  • Hello

    I am using RT TOOL BOX 3 for programming Mitsubishi RV-7FRLM-D roboter. I need to convert bit/byte/word to integer. I dont know how is it possible to convert in this programming language(Melfa basic VI --> RT TOOL BOX 3). If anyone has an idea, please help me.

    Thank you.

    Best regards

  • Hello

    Thank you for your replay.

    Actually I will use a sensor which measures the distance (analoge data measured by voltage level)and it will send to PLC. And in PLC it will convert to binary data and then it send to robot. Then Robot program will convert this binary data to integer and then Robot will go to that instraction(like distance). This is the think I need to do. Therefore I need to convert binary to integer.


    best regards

  • As I understand, you are going to get from the PLC number for example - 100 in binary - 1100100 ? Then you can just read it directly using M_In16 instruction like :


    *loop

    M1 = M_In16(2200)

    PCurrPos = P_Curr

    PCurrPos.X = M1

    Mov PCurrPos

    GoTo *loop


    In this example you can move your robot in X axis from the PLC.


    If I got it wrong just say it and maybe we'll find another solution!

  • If you receive data from plc with command M_In you can use

    M_In(address) => for get bit

    M_In8(address) or M_Inb(address) => for get 8 bit / half word

    M_In16(address) or M_Inw(address) => for get 16 bit / 1 word

    M_In32(address) => for get 32 bit / double word


    or maybe you can set format from variable to convert type

    M1% = M_In16(address) ------ %= integer format

    M1# = M_In32(address) ------- #= long format (double word)

    M1! = M_In16(address)/100.0 ----- != floating point single precision format

Advertising from our partners