1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Negative value from PLC

  • LUCAF
  • March 29, 2024 at 11:26 AM
  • Thread is Unresolved
  • LUCAF
    Trophies
    1
    Posts
    6
    • March 29, 2024 at 11:26 AM
    • #1

    Hi everyone, I'm trying to transfer a 16-bit signed integer from an API.

    code : SIGNAL offset_x $IN[124] TO $IN[139]

    on the plc side, my variable is declared as a signed integer

    when I visualise my variable "offset_x" when I send 25 I receive 25 but when I send -25 I receive 65511 which means that on the work visual side my variable is declared as a UINT

    Can you help me solve my little problem?

    Thank you

    Translated with DeepL.com (free version)

  • Fubini March 29, 2024 at 11:42 AM

    Approved the thread.
  • MOM
    Reactions Received
    175
    Trophies
    7
    Posts
    1,424
    • March 29, 2024 at 1:52 PM
    • #2

    This is correct.

    For negative number the "Two's complement" is used

    The explanation can be found here

    65511= '1111 1111 1110 0111'

    MSB (red) = 1 => number is negative

    pasted-from-clipboard.png

    If we would just take 8 bits then the number would be 231 in binary '1110 0111'

    -128+64+32+4+2+1 = -25

  • hermann
    Reactions Received
    407
    Trophies
    9
    Posts
    2,612
    • March 29, 2024 at 2:45 PM
    • #3

    Easiest way is to expand the signal to 32 bit. Then the Kuka uses the MSB as sign automatically.

    Otherwise you have to caculate the two's complement by yourself

    Code
    value = offset_x 
    if value > 32767 then
     value = value-65536
    endif

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • Group Inputs/Group Outputs between RobotStudio and Allen-Bradley PLC

    • PhilC
    • September 13, 2023 at 9:38 PM
    • ABB Robot Forum
  • Send a real number to PLC (siemens) connected by Profinet

    • MoEL
    • September 7, 2023 at 4:14 PM
    • Fanuc Robot Forum
  • Get signed 32-bit integer from two unsigned 16-bit GI's

    • hoitzing
    • February 28, 2023 at 10:39 AM
    • Fanuc Robot Forum
  • Negative Data Pass

    • Chris
    • June 6, 2016 at 3:43 AM
    • Fanuc Robot Forum
  • sps.sub user PLC section

    • robot-cnc
    • December 29, 2022 at 1:54 PM
    • KUKA Robot Forum
  • Have You Ever Crashed A Robot?

    • ablant527
    • June 14, 2021 at 9:31 PM
    • General Discussion of Industrial Robots Only
  • Connecting Kuka Arm to Arduino using Media Flange

    • Pt13
    • March 31, 2022 at 7:13 PM
    • KUKA LBR IIWA
  • Passing positions to siemens PLC over profibus

    • jariuscs
    • April 23, 2020 at 6:19 PM
    • Fanuc Robot Forum

Tags

  • KUKA
  • négatif
  • valeur
  • entier
  • signé
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download