zerbzhang Posted August 18, 2023 Posted August 18, 2023 For an analog quantity of ± 10v, the ecat slave station data ranges from negative 32768 to positive 32767; When reading data on Pmac_ECAT, the Ecat [i]. io [j]. Data data is 0-65535; How to Set Up to Display Correct Results Consistent with ECAT Slaves? Quote
Omron Forums Support Posted August 18, 2023 Posted August 18, 2023 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]. Quote
zerbzhang Posted August 19, 2023 Author Posted August 19, 2023 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? Quote
leandro.martins Posted August 21, 2023 Posted August 21, 2023 (edited) 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 August 21, 2023 by leandro.martins 1 Quote
Omron Forums Support Posted August 22, 2023 Posted August 22, 2023 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. 1 Quote
Alex Anikstein Posted August 22, 2023 Posted August 22, 2023 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: 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: 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. 1 Quote
Omron Forums Support Posted August 23, 2023 Posted August 23, 2023 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 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.