I’ve been working on getting the PLC to connect to local modbus server. Eventually the goal is to use it with an EMPRO for energy management. I’ve followed the thread Small Modbus Example and got to the point of trying to compile the CPP program in a linux virtual machine.
The first part if this is that the library builder program does’t work in my VBOX even though I ran “sudo apt-get install mono-complete” and rebooted, so I’d like to know what I’m doing wrong in this situation.
And after that, I can just change the IP address and port number in the “CPP_LibmodbusCPP” example from the website to connect to a different server, yes? Would be happy to provide more information to help solve this.
edit: it has been brought to my attention (thanks Martin), that some examples do list the mono as a means to run the library builder. So I guess I was a bit harsh, apologies for that. I’m not sure what you have tried exactly. But usually you build first the LibModbus shared object. You than link the shared-object into your application, and package this together with the library builder. Can you share an image of what error you get? -----------original-------------------- First of all, The library builder is used from the Windows environment. I’m don’t follow why you installed mono, I guess wine would be more appropriate but again. The library builder is typically only used from within a Microsoft Windows environment. Basically in your linux VM you create the LibModbus module (the .so or .a file). You use this shared-object in your windows Eclipse environment with your own code to build the final library. So there are four steps:
1. Create the LibModbus shared object (or static, whichever you prefer)
2. Use the shared object in your eclipse environment to build your typical application against this shared object.
3. Build the PCWE-library, which comprises of your application (your code + the shared/static object), using the library builder
4. Configure your programs in PCWE and wire-up the GDS
Cheers,
Vincent
Hey, regarding the problem with the librarybuilder you have to make sure it is executeable.
"ls -l "to check if it already is executable
chmod +x *Librarrybuilder.exe to make it executable. Also the example you mentioned is quite old/alpha version:
I expect a new example with a detailed dokumentation to be released in the following week.
I will update you with a link as soon as it is released.
Here a preliminary Version.
The release version will be available on the phoenixconact.com → AXC F 2152 soon.
PCWE_EX_CPP_LibmodbusTCP_2.zip
EX_CPP_LibmodbusTCP_2.PDF
Hi When i run the sudo ./SetupConfig.sh i get following fault and then it stops the installation Makefile:390: recipe for target ‘install-libLTLIBRARIES’ failed
make[2]: *** [install-libLTLIBRARIES] Error 127
make[2]: Leaving directory ‘/home/support/work/libmodbus-3.0.6/src’
Makefile:581: recipe for target ‘install-am’ failed
make[1]: *** [install-am] Error 2
make[1]: Leaving directory ‘/home/support/work/libmodbus-3.0.6/src’
Makefile:456: recipe for target ‘install-recursive’ failed
make: *** [install-recursive] Error 1 Regards
Dan Møller PxC Denmark
Hello Dan, something is wrong with your C Compiler properbly.
Did you adapt the SetupConfig.sh for your own Operating system?
you need to adapt the path to the SDK ect… I updated my previous post with the latest version of the Modbus Example.
Hello Dan, you have to edit the *.sh file with a text editor and change the paths. where is the environment script:
"/opt/pxc/current/**environment-setup-...** "
to
"/where/ever/YouInstalledTheSDK/**environment-setup-.**.."
Where is the Sysroot:
"/opt/pxc/current/**sysroot** "
to
"/where/ever/YouInstalledTheSDK/**sysroot** "
and change the path where the compiled library is placed:
"/opt/pxc/install"
to
"/where/ever/you/want/Install"
Hi Dan, Did you manage to compile libmodbus? I just compiled the latest version this morning, was a smooth ride after configuring the right variables to point to the correct path where you have unpacked the PxC-Linux-SDK. Cheers,