Help to use libplctag4j

208 views
Skip to first unread message

Luis Andrade

unread,
Feb 25, 2021, 5:31:25 PM2/25/21
to libplctag
Hello everyone, I'm trying to implement libtagplc with java so i used this wrapper and I tried to adapt example.c to java but i doesn't works, I'm getting the error PLCTAG_ERR_NOT_FOUND (-19), but if i use the native tag_rw i can get the info without problems so maybe it is something that i miss?I thank you in advance for any help.
I'm gonna attach the java source code(Main.java), how it works with tag_rw
tag_rw_test.jpg
and the error code that i get in my execution of my java program

java_program_execution.jpg
Finally, I scanned the network with wireshark while the program was executing and it apparently gets the correct answer you can watch the data is the same as tag_rw received but in reverse.
wireshark_scanning.jpg
Thanks for the attention i will wait for your answers.
Main.java

Kyle

unread,
Feb 27, 2021, 8:16:52 PM2/27/21
to libplctag
Hi, thanks for reaching out.  

I tried the latest release by reading an INT from a PLC-5 and a string from a ControlLogix.   I was able to read both.   I looked through your code a few minutes and did not see anything really obvious.  You do not need a "path=0" element in your tag attribute string.  It is ignored.

I just updated the Java release in libplctag4j to support the latest C API changes.   In order to test the string API, I made a short example program (attached here).   Please look at the part that reads an INT tag (N7:0) from a PLC-5.   You should be able to use that part (remove the string code) to start from.  The example program also shows how to enable debugging output in the core library to see what is happening inside the library.

Please look at the example and let me know if that helps you.

Best,
Kyle
TagExample.java

Luis Andrade

unread,
Mar 4, 2021, 12:29:29 AM3/4/21
to libplctag
Thank you so much I don't know how but with your update and your example i could connect and read the tag successfully.
I will communicate with you if anything new happens.
Again, thank you very much.
Reply all
Reply to author
Forward
0 new messages