Hi folks, I have a Spyder-Plus tension control module on a wire spooling machine. This is a new piece of kit. I can read data from it over Modbus using an MVI56E-MNETC Prosoft card, in a Rockwell CLX chassis. This works as expected.
The problem comes when I need to write a float to it for setting the tension setpoint. I create an entry in the MNETC card for its own register - 558 lets say - occupying 2 Modbus registers, then COP the float value into the MNETC.Data.Writedata[558] which should convert the float into IEEE 754 format and place two UINTS into register 558 & 559 (high word in the higher register as that's how the Spyder works if you don't swap-words at the MNETC end) yet it does not work; It seems to ignore the value sent, and when I look into the data in the controller tags for the MNETC write block, it (Studio / CLX PLC) has written the correct value to the higher register (the integer part of the IEEE 754 conversion) and the remainder of the floating point part + the exponent + mantissa part should occupy the lower register. But it contains a copy of the integer value itself, not even a converted one.
Say we want to send 16.5; the 559 register should contain 16772 and the 558 register should contain 0 - but it puts the -26214 in there where zero should be. I cobbled a python script together to do the IEEE 754 conversion from float to 32 bit binary so I could tell what the registers should hold and be able to check easily (the maths is long winded doing it by hand)
So the long and short is, why can I not say COP MyFLoat => MNETC.Data.WriteData[558] and have it work? I tried moving the float to a DINT first but that lops off the fractional part. If anyone has experience of writing a float (REAL) to a ProSoft MNETC card I would love to hear their thoughts.
This is what it should equate to in the registers of the PLC for the MNETC card: (IEEE 754 format)
16.5 as a 32-bit binary number: 0x41840000 (IEEE 754 format)
Hex representation as two 16-bit numbers: 4184 0000
Decimal representation as two 16-bit numbers: 16772 and 0
Instead, the registers hold 16772 and -26214 and the Spyder sees the value sent as an error of course - duly ignoring it - I don't understand why the PLC is doing this. Oh and for info, I am using Function 16 - Write Multiple Registers for a length of 2 registers (all registers in the MNETC are 16 bit each so need to use two) in the MNETC to the Spyder. I am certain the issue is the way the CLX PLC is handling the float to binary32 with the COP instruction.
Thanks.
The problem comes when I need to write a float to it for setting the tension setpoint. I create an entry in the MNETC card for its own register - 558 lets say - occupying 2 Modbus registers, then COP the float value into the MNETC.Data.Writedata[558] which should convert the float into IEEE 754 format and place two UINTS into register 558 & 559 (high word in the higher register as that's how the Spyder works if you don't swap-words at the MNETC end) yet it does not work; It seems to ignore the value sent, and when I look into the data in the controller tags for the MNETC write block, it (Studio / CLX PLC) has written the correct value to the higher register (the integer part of the IEEE 754 conversion) and the remainder of the floating point part + the exponent + mantissa part should occupy the lower register. But it contains a copy of the integer value itself, not even a converted one.
Say we want to send 16.5; the 559 register should contain 16772 and the 558 register should contain 0 - but it puts the -26214 in there where zero should be. I cobbled a python script together to do the IEEE 754 conversion from float to 32 bit binary so I could tell what the registers should hold and be able to check easily (the maths is long winded doing it by hand)
So the long and short is, why can I not say COP MyFLoat => MNETC.Data.WriteData[558] and have it work? I tried moving the float to a DINT first but that lops off the fractional part. If anyone has experience of writing a float (REAL) to a ProSoft MNETC card I would love to hear their thoughts.
This is what it should equate to in the registers of the PLC for the MNETC card: (IEEE 754 format)
16.5 as a 32-bit binary number: 0x41840000 (IEEE 754 format)
Hex representation as two 16-bit numbers: 4184 0000
Decimal representation as two 16-bit numbers: 16772 and 0
Instead, the registers hold 16772 and -26214 and the Spyder sees the value sent as an error of course - duly ignoring it - I don't understand why the PLC is doing this. Oh and for info, I am using Function 16 - Write Multiple Registers for a length of 2 registers (all registers in the MNETC are 16 bit each so need to use two) in the MNETC to the Spyder. I am certain the issue is the way the CLX PLC is handling the float to binary32 with the COP instruction.
Thanks.
Last edited: