FLAutomation

Looking for NJ/NX Communication DLLs for Visual Studio

30 posts in this topic

Hello, I am working on a project currently that uses a windows application on a PC to communicate with an NX1P2 controller to read and write variables data.

I found a course on Udemy which has a Visual Studio project with OMRON DLLs that are used for these communications.

I confirmed with OMRON that they do have official DLLs for this, but the technical support guy has told me he is trying to find them himself.  

I have attached a screenshot of the DLL references.  I am really looking for the DLL libraries, aswell as the documentation on their functionality to I can use them to communicate.

Any help would be greatly appreciated!

 

DLL References.png

Share this post


Link to post
Share on other sites

Pretty sure those are part of the Sysmac Gateway product and/or Sysmac Gateway SDK.

Big $$$

Share this post


Link to post
Share on other sites
39 minutes ago, pturmel said:

Pretty sure those are part of the Sysmac Gateway product and/or Sysmac Gateway SDK.

Big $$$

Hmm.  The guy on Udemy claims he got them directly from OMRON .

After speaking with OMRON tech support yesterday, The guy told me they do have these DLLs and he would find them and send them over to me along with the documentation.

I was just reaching out to see if anyone else has been down this path already. I spoke with OMRON USA but it seems their website is lacking alot of the example code, libraries, and documentation that OMRON France has. For some reason OMRON France seems to have much more download support than any other OMRON support.

Share this post


Link to post
Share on other sites
1 hour ago, pturmel said:

Pretty sure those are part of the Sysmac Gateway product and/or Sysmac Gateway SDK.

Big $$$

Update, After talking with another support agent, The DLLs and files are a part of Sysmac Gateway / Compolet and require a license.  You are correct.     Im going to look into purchasing a license. Thanks for the feedback

Share this post


Link to post
Share on other sites
3 hours ago, FLAutomation said:

Update, After talking with another support agent, The DLLs and files are a part of Sysmac Gateway / Compolet and require a license.  You are correct.     Im going to look into purchasing a license. Thanks for the feedback

I'm pretty sure a trial is available. Let me check...

Share this post


Link to post
Share on other sites

Only for 2003 version. Not sure that will be beneficial

Share this post


Link to post
Share on other sites

Have you looked in to using OMRON's FINS protocol? Do a Google search for Omron FINS protocol to VB .NET. Someone actually had a video explaining how to do this with a link to his web page for the file. 

Share this post


Link to post
Share on other sites
11 hours ago, skyfox said:

Have you looked in to using OMRON's FINS protocol? Do a Google search for Omron FINS protocol to VB .NET. Someone actually had a video explaining how to do this with a link to his web page for the file. 

I don't think NX PLC can work with FINS. Only the NJ PLCs can talk FINS. We found this out when switching over from CJ2 PLCs and had to rewrite some PC software.

Share this post


Link to post
Share on other sites

With NX You need use CX-Compolet, if You download only dll's you are have license error. Fins it's old protocol, better use EthernetIP or CIP.

Edited by Winciu

Share this post


Link to post
Share on other sites
On 4/22/2022 at 6:26 AM, kckku said:

I don't think NX PLC can work with FINS. Only the NJ PLCs can talk FINS. We found this out when switching over from CJ2 PLCs and had to rewrite some PC software.

NX102 and NX7 can do FINS, NX1P2 can't.

Share this post


Link to post
Share on other sites
On 4/23/2022 at 3:07 PM, photovoltaic said:

NX102 and NX7 can do FINS, NX1P2 can't.

Was this changed recently? I remember we had to use Sysmac Gateway for PC communications because the NX7 that we ended up using couldn't use FINS. This was back in 2017 or so.

Edited by kckku

Share this post


Link to post
Share on other sites
2 hours ago, kckku said:

Was this changed recently? I remember we had to use Sysmac Gateway for PC communications because the NX7 that we ended up using couldn't use FINS. This was back in 2017 or so.

Looks like 1.16 was when it got implemented

Share this post


Link to post
Share on other sites
On 4/19/2022 at 5:41 AM, FLAutomation said:

Hello, I am working on a project currently that uses a windows application on a PC to communicate with an NX1P2 controller to read and write variables data.

I found a course on Udemy which has a Visual Studio project with OMRON DLLs that are used for these communications.

I confirmed with OMRON that they do have official DLLs for this, but the technical support guy has told me he is trying to find them himself.  

I have attached a screenshot of the DLL references.  I am really looking for the DLL libraries, aswell as the documentation on their functionality to I can use them to communicate.

Any help would be greatly appreciated!

Few days ago, I came across a Sysmac Studio library file that allows MODBUS TCP communications with an NX1P2 CPU. This was published by OMRON France. Viva La France. I was able to find these files thanks to a member on this Mr.PLC forum named "nanie1991" from Malaysia in a reply on 7-2-2020 to a post named " OMRON PLC with Modbus TCP/IP", that was started on 11-13-2017.Using this Sysmac library, I was able to successfully communicate with an NX1P2 PC using a VB program that I created. I was using the free "EasyModbus.dll" library file available at Source forge with my VB.Net program. That DLL allows you to create a MODBUS TCP Client that can then be used for communicating with a MODBUS TCP server. It also allows you to create a modbus server as well. Basically, you can use any TCP client to talk to the OMRON PLC once you have the SYSMAC library. It only takes 1 rung of code and few tags to make it happen. The EasyModbus home page is at the link below.  I am using the latest version which is 5.06. There are plenty of code examples and library documentation available at the site. I am writing my program in Visual Basic Net (2010) free express edition. I also have tested it using Visual Basic Express 2017. Examples on EasyModbus site are in C# for the dot Net platform. Those can be easily adopted for VB. If anyone is  interested, I will upload my VB.Net project files when done. I am currently working on finishing up the data logging portion of it to a PC and should have it done in a couple of days. I am only reading 16 Tags. But the source code can be easily changed to allow read/write coils and registers etc.

 

Image1.png.1ca7c9f35f71afa02d8e70b8edb4e

 

See the attached PDF on using the function block. Attached is a working MODBUS TCP server Sysmac project for an NX1P2 PLC. You should be able to find a free Modbus client to test it out or create your own using the EasyModbus.dll library. Be sure to put the SERVER in a periodic task. I was not able to find or access the TCP/IP Keep-Alive settings on Sysmac side that PDF talks about on page #3. Nevertheless, I was able to successfully communicate with the NX1P2 while it was attached to an NB series HMI as well as being online with it with Sysmac Studio all at the same time. Did not notice any adverse comms issues or with my regular program with 4 Ether Cat slave nodes. Then again, I am only reading in 16 registers with a polling rate of 1 sec.

 

626b93f0b0ce0_NX1P2MODBUS_TCP.thumb.png.

MTCP_Server_NJNX_E.pdf

 

Cheers.

 

EDIT:

Unfortunately, forum is not allowing me to upload my Sysmac project file. Throws a warning saying only allowed to upload a 3.91 MB file, Not sure because this post has several uploads. I will try again after posting this. My Project file is only 4.03MB and it does not compress to any lower either. Follow the link in the PDF to get the OMRON library file and the screenshot above shows the only logic needed to get started with MODBUS TCP comms with an NX1P2 PLC.

 

 

Edited by skyfox
1 person likes this

Share this post


Link to post
Share on other sites

Still can't upload my Sysmac project file for my reply above. File size limit of 3.91MB limit seems rather odd. Project file is 4.03MB (after compressing) and I can't reduce it anymore in Sysmac Studio. I only have two total rungs of code and few tags. It won't now even allow me to paste a 32Kb png file showing the file size of my Sysmac project. Throws the same you are only allowed 3.91MB upload. Is that size for one topic? Anyone knows how I can upload my project file on to this thread?

Cheers.

 

 

 

Share this post


Link to post
Share on other sites
6 hours ago, skyfox said:

Still can't upload my Sysmac project file for my reply above. File size limit of 3.91MB limit seems rather odd. Project file is 4.03MB (after compressing) and I can't reduce it anymore in Sysmac Studio. I only have two total rungs of code and few tags. It won't now even allow me to paste a 32Kb png file showing the file size of my Sysmac project. Throws the same you are only allowed 3.91MB upload. Is that size for one topic? Anyone knows how I can upload my project file on to this thread?

Cheers.

 

 

 

Is there an HMI in your project?

You could also strip out any libraries you're not using

Share this post


Link to post
Share on other sites
3 hours ago, photovoltaic said:

Is there an HMI in your project?

You could also strip out any libraries you're not using

Yes. There was an NA HMI in the project. I removed it and deleted the unused libraries and was able to get the size down to 1.9MB. Trying again.

NX11P2_MODBUS_TCP.smc2

Share this post


Link to post
Share on other sites

Use socket UDP or TCP to exchange data, very simple and without dependency.

Share this post


Link to post
Share on other sites

63a1c5376864c_FINSNX.thumb.jpg.035264185

One confirmation and one additional note with regards to FINS comms on NX controllers.  The NX7 could support FINS as of v1.16 as stated by @photovoltaic and ONLY port 2 supports FINS commands on the NX102.  I posted to make the point about port 2, but since the 1.16 point was here in this graphic as well, I thought that I would confirm.  Never doubted you @photovoltaic!

 

1 person likes this

Share this post


Link to post
Share on other sites
On 4/23/2022 at 1:07 PM, photovoltaic said:

NX102 and NX7 can do FINS, NX1P2 can't.

I should clarify as well - NX1P2 will respond the FINS data requests (ex. D100 qty:5). The controller doesn't support all FINS messages and you can't use issue any messages with it, but for reading and writing data with a PC FINS will work. The manual claims that it is not supported but for the OPs application it may be enough.

Share this post


Link to post
Share on other sites

Make data type structure "sMessage" in NX with NJ Offset Type like this :

sMessage    STRUCT                NJ
Version    UINT                
TransactionID    UINT                
Command    UINT                
Flags    ARRAY[0..15] OF BOOL                
Param1    ARRAY[1..4] OF DINT                
Param2    ARRAY[1..4] OF REAL                
Texte    STRING[128]    

Produce a similar structure in C++ code or C# code :

struct sMessageT
{
    uint16_t version = 1;
    uint16_t tid = 0;
    uint16_t cmd = 0;
    uint16_t flags = 0;  
    float    param2[4] = { 0.0f };
    uint8_t  txt_utf8[128];
};

Use socket UDP or TCP to exchange data between PC and NX.

Works with all NX. Works with port #1. No FINS nodes problems. Very simple.

1 person likes this

Share this post


Link to post
Share on other sites

JYG,

 

Would you happen to have some sample code on how to accomplish this for us newbies in the OMRON ecosystem? That would be awesome. I am looking for how to set this up in the NX1P2 side. I can sort out the other end.

Cheers.

 

 

Share this post


Link to post
Share on other sites

You can look at Omron Instructions manual or on line help under SktUDPCreate() function for a complete example on the server side and client side.

You must choose to use UDP or TCP for your application.

Usually the PLC is the server and wait request from client but you can also choose to send data to client as soon new data is available. Your decision.

If you have specific questions I will answer you.

Share this post


Link to post
Share on other sites
On 2023. 01. 10. at 1:20 PM, JYG said:

Make data type structure "sMessage" in NX with NJ Offset Type like this :


sMessage    STRUCT                NJ
Version    UINT                
TransactionID    UINT                
Command    UINT                
Flags    ARRAY[0..15] OF BOOL                
Param1    ARRAY[1..4] OF DINT                
Param2    ARRAY[1..4] OF REAL                
Texte    STRING[128]    

Produce a similar structure in C++ code or C# code :


struct sMessageT
{
    uint16_t version = 1;
    uint16_t tid = 0;
    uint16_t cmd = 0;
    uint16_t flags = 0;  
    float    param2[4] = { 0.0f };
    uint8_t  txt_utf8[128];
};

Use socket UDP or TCP to exchange data between PC and NX.

Works with all NX. Works with port #1. No FINS nodes problems. Very simple.

Hi JYG!

How do you sent the structure from the PLC? Convert he stuct to array of byte?

And in c# how can I convert the message to structure?

Share this post


Link to post
Share on other sites

Yes, because the SktUDPSend() need a ARRAY[0..1999] of BYTE.
Using ToAryByte() transform the structure in bytes and computes the size in the structure.

Using the default Offset type NJ for the structure is the same packing and the same endian of Visual Studio C#.
In C you can cast the bytes buffer receive from socket in pointer to struct. Voilà!

2 people like this

Share this post


Link to post
Share on other sites
On 2/18/2023 at 4:58 AM, JYG said:

You can look at Omron Instructions manual or on line help under SktUDPCreate() function for a complete example on the server side and client side.

You must choose to use UDP or TCP for your application.

Usually the PLC is the server and wait request from client but you can also choose to send data to client as soon new data is available. Your decision.

If you have specific questions I will answer you.

Thanks. I will have a look.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now