Hi Team,
This looks like a wonderful library and I was trying to fetch data from OMRON NX102 hardware. Later on, I have to try the same with CJ2M as well.
I can create and control all the tags and code in the PLC and I created a tag in the NX PLC as ToPLC (4 Bytes) and FromPLC (4 Bytes). The PLC IP is configured to 10.0.0.1 and PC as 10.0.0.2.
I am using to libplctag-2.5.2 and using simple_cpp.cpp as my code and pre built libraries. After reading the conversation (shown in Italic below) I used my TAG_PATH as:
#define TAG_PATH "protocol=ab-eip&gateway=10.0.0.1&path=18,10.0.0.1&plc=omron-njnx&name=FromPLC"
but the code is throwing exception at line:
/* create the tag */
tag = plc_tag_create(TAG_PATH, DATA_TIMEOUT);
#1 Can anyone please guide about what is wrong here?
I had linked the libraries cli.lib, plctag.dll, plctag.lib, plctag_static.lib in an empty VS2019 solution and copied the code from simple_cpp.cpp and managed to compile and link successfully.
#2 Can someone also help me with any instructions or any resources about how to compile the source code (with visual studio 2019)? I used CMAKE tool and converted to VS2019 solution and then did build all. But it did not generate any dll or lib.
I assume I need to generate cli.lib, plctag.dll, plctag.lib, plctag_static.lib for running a new project with custom code. I was not able to generate above with build all in VS.
Below is the conversation I was referring to.
conversation subject: trying
to use the libplctag4j but PLCTAG_ERR_NOT_FOUND
May 21, 2022, 3:21:57 PM
to libplctag
Hi, thanks for using the library!
The path for Omron PLCs is a bit weird.
Your path is "0" which is definitely not going to work. The path needs to have the IP address of
the PLC in it as if you were using CIP bridging to it:
protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray
Replace the "127.0.0.1" with the correct PLC address.
Try this using the core library tag_rw2 test tool. With that you can try different tag
strings until you get it wright without having to recompile your code.
Let me know if this helps!
Best,
Kyle