32bit to 2 16bit

  • Maybe don't use GOs at all. Just set up a 32-bit range of DOs, and set them using a loop with DIV2 to act as a bit-shift-right, and MOD 2 to basically check the lowest bit :




    My TP is weak, but this seemed to work okay when I tested it.



    EDIT: well, maybe not. Once I got into very large numbers, it looks like the lower-order bits seem to get lost. Maybe rounding error in the DIV function?


    For example, if I input 252645136 (1111 0000 1111 0000 1111 0000 1111), DOs 29-32 are set ON, but 1-4 are set False, and DO 5 is ON.

  • The fanuc handles registers (especially at the range of 2^31) a bit strange.

    Sometimes he handles them as integer and sometimes he handles them as float.

    If integer is the actual state, you can only handle values from -2,147,483,648 to +2,147,483,646 then the direct method works if it is a positive value. For negative values a special calculation will be necessary.

    +2,147,483,647 is displayed as "*******"

    And one more strange behaviour: f.e. if you try to change a register to 2147483500 he value will be accepted but changed to 2147483520.

    values from round about 2147483600 are changed to floats.

Advertising from our partners