Modbus TCP - AXC F 1152 and EMpro power meter

Good day
I’m looking to get the power factor from the EMpro power meter to the 1152 controller with Modbus TCP. How do I establish this connection? I’ve tried the TCP_Socket, TCP_Send and TCP_Receive FB’s, but couldn’t get a connection.
Thanks

The TCP_* function blocks are only for raw TCP socket communication; they do not implement the Modbus protocol.
The Modbus TCP library in the PLCnext Store includes a Modbus TCP Client function block, which should work.

Ian:
I have a sample project where I used the Modbus TCP library to pull (30) registers from the EEM power meter.
The first pic shows the use of the Modbus libraries to read the data.
EEM Read Pic1.jpg
Once you read the data, then you have to parse the pf from registers 29 & 30.
EEM Read Pic2.jpg
The function I use for convert 2 Words into 1 Real:
EEM Read Pic3.jpg
PS: I was going to attach the program but it appears I cannot attach a PLCnext Engineer project. Hope these screen shots work (and you can read them).

SFW

Nice one.
The conversion function could also be something like:

temp_DWORD.W0 := Word2;
temp_DWORD.W1 := Word1;
Real1 := TO_REAL(temp_DWORD);

… but that’s not significantly different to what you’re doing.

Ian:</p>I have a sample project where I used the Modbus TCP library to pull (30) registers from the EEM power meter. </p>The first pic shows the use of the Modbus libraries to read the data.</p>[https://forum.plcnext-community.net/uploads/HC2J71GEX9XU/eem-read-pic1.jpg</a></p>Once you read the data, then you have to parse the pf from registers 29 & 30.</p>[https://forum.plcnext-community.net/uploads/RC7D9ANFQQD6/eem-read-pic2.jpg</a></p>The function I use for convert 2 Words into 1 Real:</p>[https://forum.plcnext-community.net/uploads/5PSEXRXLXL8Q/eem-read-pic3.jpg</a></p>PS: I was going to attach the program but it appears I cannot attach a PLCnext Engineer project. Hope these screen shots work (and you can read them).</p>SFW</p>

Is there anyway for you to make the program available for me? I’ve work through your explanation and it helped me a lot. I’m struggling to create the 2W_To_Real FB.

Thanks so far.

Hello,

this is my WORDS_RO_REAL function that should solves your problem.

image.png

[https://forum.plcnext-community.net/discussion/comment/11076#Comment_11076</a></p>Is there anyway for you to make the program available for me? I’ve work through your explanation and it helped me a lot. I’m struggling to create the 2W_To_Real FB.</p>Thanks so far.</p>

How can I reach you – I will be happy to send it to you.

thanks for your example steve.windham