PMP23 with Negative Pressure Solution
OK, just to complete this thread I am including below my solution to properly interpolate both Positive and Negative pressure from an Endress Hauser PMP23 connected to an IFM IOLink Master Module.
The biggest hurdle is preserving the negative from a 30 Bit INT when “MOVing” it into a REAL data type. One way is to shift the entire 30 bit INT (which in the PLC is living within a DINT) so that the Negative bit (which in a 30 bit INT is at bit 29) ends up at bit 31 of the DINT (where is belongs).
Then divide the DINT by 3 (which in Binary is bits 0 and 1 set) to a REAL data type. This preserves the negative value and converts it to a REAL.
Anyway, hope this might help someone in the future …
... see code snip below …
FYI: I tuned up some of the tag descriptions to help everyone follow the bouncing ball.
OK, just to complete this thread I am including below my solution to properly interpolate both Positive and Negative pressure from an Endress Hauser PMP23 connected to an IFM IOLink Master Module.
The biggest hurdle is preserving the negative from a 30 Bit INT when “MOVing” it into a REAL data type. One way is to shift the entire 30 bit INT (which in the PLC is living within a DINT) so that the Negative bit (which in a 30 bit INT is at bit 29) ends up at bit 31 of the DINT (where is belongs).
Then divide the DINT by 3 (which in Binary is bits 0 and 1 set) to a REAL data type. This preserves the negative value and converts it to a REAL.
Anyway, hope this might help someone in the future …
... see code snip below …
FYI: I tuned up some of the tag descriptions to help everyone follow the bouncing ball.