Jump to content
OMRON Forums

Reading Actual Torque Values Over ECAT


Lobenstein

Recommended Posts

I can't seem to get the actual torque values to come in as a 16 bit signed value through PDO mapping. If the torque is a negative number it rolls over and I get some large value. The only way I can seem to make it work is to bring in the actual torque through the encoder conversion table and scale it there and just read the DeltaPos value. Is this the best method or is there a way to bring this PDO in as a 16 bit signed number?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

It never occurred to me to run all those values through the ECT just for tuning/charting purposes, so I came up with a hack that works for the plot tool:

ECAT[0].IO[1].Data.a - (ECAT[0].IO[1].Data.a & 32768) - (ECAT[0].IO[1].Data.a & 32768)

Obviously substitute your values for ECAT[0] and IO[1].  Then use the plot scale factor as necessary to scale to 100% or whatever.  It works because to convert from the 16-bit 2s complement, you subtract 2^16 from the unsigned number.  The bitwise & picks out bit 15 to indicate sign and subtracts 2^15 twice to convert to the signed form.  You have to subtract twice for this to work in Plot Tool.  I tried bit shifting or multiplying by two with any number of parentheses and Plot Tool couldn't parse it.  Subtracting twice was the only thing that worked.

If you wanted to use this in Script or C, this #define should work:

#define Torque(value) (value - (value & 32768) << 1)

None of these work if you need the torque value available for servo-loop processing or the like, obviously.  The ECT would be your only option for that.

Edited by ksevcik
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...