E+H Pressure Transmitter to CompactLogix via IOLink

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.

PMP23 Code.png
 
I am all but certain the divisor should be 4 not 3, the CLR should not be necessary with the current method, and a simpler approach would replace the

NXB CLR ... MVM ... NXB BTD ... DIV ... BND


inner branches, plus the first MUL on the next rung, with

NXB XIC Helper_DINT[10].29 OTE Helper_DINT[10].30 OTE Helper_DINT[10].30 NXB MUL Helper_DINT[10] 0.001 PT_4232.PSI BND


That said, how does multiplying -29.3334 by 0.001 yield a result of -0.022?
 
Last edited:
I am all but certain the divisor should be 4 not 3...

WOW!!! Good catch DrBitboy. When metrology performed a bench test of the pressure sensor it is was off by a 1.33 multiplier (for both negative and positive pressures) which (after reading your reply) now make sense ... I was dividing by 3 instead of 4 (hence 4/3 = 1.33). THANK YOU!!!


NXB XIC Helper_DINT[10].29 OTE Helper_DINT[10].30 OTE Helper_DINT[10].30 ...

I believe I know what your getting at but please check your code. You have two "OTE Helper_DINT[10].30 OTE Helper_DINT[10].30" in a row AND I think I should be setting bit 31 instead of bit 30.
Also, wouldn't I need to OTU bit 29 using this method?
Are you just trying to move the negate bit to its proper location in the DINT?

So, I tried this (moving the negate bit to bit 31) early on and it works perfect for positive values ... but when the value (pressure) goes negative you can no longer just move the negate bit because of how signed binary stores negative numbers.

Is my thinking correct?? I would love a simpler approach if you can think of one. I actually created an AOI since I have 23 of these pressure sensors

That said, how does multiplying -29.3334 by 0.001 yield a result of -0.022?

My bad, I actually had this rung AFIed when I took the screen shot.


Again, thank you for finding my Divide by 3 bug.
 
WOW!!! Good catch DrBitboy.

Well, I am drbitboy.

I believe I know what your getting at but please check your code. You have two "OTE Helper_DINT[10].30 OTE Helper_DINT[10].30" in a row AND I think I should be setting bit 31 instead of bit 30.

Yes, good catch on your part! However, just to be clear, you should be setting them both i.e. sign extension or zero extension; See this link.

Also, wouldn't I need to OTU bit 29 using this method?
Are you just trying to move the negate bit to its proper location in the DINT?
I don't think so: I am doing either sign extension or zero extension.

If the high bit of the 30-bit integer, i.e. bit .29, is 1, then the number is a negative 30-bit integer, and all that is needed is to extend the sign out to both bit .30 and bit .31 to make it a twos-complement, signed 32-bit integer i.e. a DINT.

For example, say the 30-bit integer was -(2**29)
=> -536,870,912
=> 0x20000000 (hexadecimal, usual convention)
=> 20000000H (hexadecimal, A-B convention)
=> 0b10_0000_0000_0000_0000_0000_0000_0000 (binary, usual convention)
=> 10_0000_0000_0000_0000_0000_0000_0000b (binary, A-B convention but with underscores for nibbles)
See image below for representation of that value in 32-bit long (RSLogix Micro Starter Lite; RSLogix 500/5000 should be similar).

And if the 30-bit integer is positive, then bit .29 will be 0, and so, in the 32-bit integer, both bits .30 and bit .31 should also be 0.

xxx.png
 
Last edited:
However, just to be clear, you should be setting them both i.e. sign extension or zero extension; See this link.

OK ... Wow!! Great info drbitboy.
After 25 years of programming PLCs (primarily ABs) I now understand how to represent the same (negative) integer value across varying lengths of bits.
A sincere thank you for walking me through this.

And ... now I KNOW how to simplify my original code.
 

Similar Topics

I need to protect some pressure transmitters from hot (120°C) oil. Does anyone have a favorite transmitter cooling element/standoff they use...
Replies
4
Views
149
Hi All, Just wondering what the best/most accepted way to measure tank level off pressure transmitter. Pressure transmitter is located in line...
Replies
6
Views
1,882
I'm trying to wire a Endress+Hauser PMP71 Pressure Transmitter to a Schneider Electric TM3AI2H Analog Input Module. The Pressure Transmitter is...
Replies
7
Views
1,270
Hello Everyone , Hope you all are well and safe sound! I'm looking solution for the pressure transmitter which are installed in Blender or Lpg/...
Replies
8
Views
2,853
Hello, I am fairly new in the field and I am having trouble creating a set point for a pressure transmitter in Studio5000. My question is, how...
Replies
4
Views
2,091
Back
Top Bottom