Jump to content
OMRON Forums

Ecat[i].Io[j].Data storage ± 10v data


zerbzhang

Recommended Posts

8 hours ago, Gregs said:

It appears that the ESI file is giving wrong info.  That said, a PLC might be used to write the value into Sys.UData[x] and read it out of Sys.IData[x].

 I am currently using the WAGO 750-476 module.   

Ecat [i].io [j].data is stored in Sys.IData[x], Sys.UData[x]. I want to know,

1)How does Sys.UData[x] correspond to the Ecat IO address?

2)Sys.IData[x]= Formula * Sys.UData[x]. How to set?

Link to comment
Share on other sites

2)
I vaguely know how Sys.IData[x]/Sys.UData[x] works.

Both of the elements points to the same memory address, being just interpreted in different format depending on what element you consult.

Negative values are stored in two's complement, so for converting you'll need to invert all of bits of the integer, then add 1.
When you query for Sys.Udata[x], the bits in that address would be interpreted as an unsigned integer:
bit0*2^0 + bit1*2^1+bit2*2^2...+bit31*2^31

e.g.
 

Sys.IData[0]=1

Sys.IData[1]=-1

Then

Sys.UHex[0]=$1
Sys.UData[0]=1

Sys.UHex[1] = $ffffffff // Inverting $00000001 --> $fffffffe, then add 1 --> $ffffffff
Sys.UData[1] = 4294967294

I don't know if that was exactly the question, but I hope that helps.
I'm sure that Gregs can complement my answer if necessary.

Edited by leandro.martins
  • Thanks 1
Link to comment
Share on other sites

What should be done depends on what's happening.  

Analog Voltage PMAC Reading (Shift by 32k) PMAC Reading (Read as Signed)    
-10V 0 32768
-5V 16384 49152
0V 32768 0
5V 49152 16384
10V 65536 32767

It's possible that PMAC is reading the correct data, but then just shifting it by 32384, and in that case, subtract and scale.  A PLC like this could be used:

    GLOBAL AnalogIn
    OPEN PLC AnalogReadPLC
    AnalogIn = (SensorValue - 32768)/3276.8  // divide by 3276.8 to convert to volts
    CLOSE

It's also possible that the data is signed, but the ESI file is telling PMAC to read it as unsigned, so the fix is to read it as signed.  In that case, writing it into UData, then reading it out of Idata may fix it.  To do that one, you'd need a PLC like:

    GLOBAL AnalogIn
    OPEN PLC AnalogReadPLC
    Sys.Udata[10] = SensorValue
    AnalogIn = Sys.Idata[10]/3276.8
    CLOSE

So, from just "it's showing 0-65k", that's not enough info to determine how to fix it. We'd need  to know when it shows 0, and when it shows 65k.

  • Thanks 1
Link to comment
Share on other sites

Just to add on a tiny bit, to explain the table Greg shared but in picture form...

 

If the data PMAC is receiving is simply shifted, such that 0V corresponds with an ECAT[i].IO[j].Data value of 32k, then the data would look like this:

image.png

However, it is also possible that the data is coming across in the incorrect data type--the device is sending signed data, but PMAC is reading it as unsigned data. In that case, 0V would correspond with ECAT[i].IO[j].Data having a value of 0, and it would "track" up to the value of 32767. However, what PMAC interprets as the most significant bit would actually be a sign bit, so any negative value sent by the device, PMAC would interpret as 32768 or greater. In this case, the data would look like this:

image.png

To correct this case, you would have to compensate for the incorrect ESI file provided by the manufacturer and "trick" PMAC to reading the data as being signed. The easiest way to do this is to make use of Sys.nData[x] (such as .IData or .Udata in this case) to read the data as a different type than what PMAC originally believed.

  • Thanks 1
Link to comment
Share on other sites

Thanks Alex.

One more thought, another approach could be to process the value as an entry in the encoder conversion table, for example with settings like this:

     Sys.Udata[]=32768

     EncTable[].pEnc=Ecat [i]. io [j]. Data

     EncTable[].pEnc1=Sys.Udata[]

     EncTable[].type=9

  • Like 1
Link to comment
Share on other sites

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...