CODESYS applications with PMX
This is a quickstart guide on starting CODESYS applications for PMX. Basic experience with CODESYS is assumed. Experienced users are free to differ. Further help is available in the examples that are normally installed on the desktop when the PMX package is installed and in the online Help for the package.
The required files are located on the "PMX CODESYS" CD included with delivery of every PMX containing CODESYS, or they can be downloaded from the support page of hbm.com.
- Installation of the CODESYS Software Suite by running the executable file "Setup_CODESYS.....exe"
- Start the CODESYS software with administrator rights. To do this hold down the shift key and right click on the icon, then select "Run as administrator".
- To install the PMX package: On the CD, in menu Tools –Package Manager –Install... find file "hbm-pmx.package" and select it. Select "Typical Setup".
The Package Manager now contains the PMX package:
Creating a project
- Select File –New Project –Standard Project. As device type select "CODESYS Control HBM PMX V3":
- After the project is created, double-click on "Device (CODESYS Control HBM PMX V3)". Add a gateway in the communications settings if necessary. (The gateway type is generally "TCP/IP" if PMX is connected with the PC via Ethernet. IP address: "localhost" or a fixed device address or PMX device name.)
- Mark the gateway entry and click "Scan Network". The target device should now be displayed. Double click to make it the active device.
- The program can be created under "PLC_PRG (PRG)".
Adding a PMX library
- Double-click on "Library Manager", then "Add Library". Under "Miscellaneous" select "HBM PMXLibrary"
- The library functions are permitted in online Help, for example
The following task types can be selected under MainTask:
The task is started asynchronously to the measured values. The interval should be at least 4 ms, which is the shortest possible resolution.
- External –Measval Event
The task is started synchronously with the measured values. The frequency at which the task is called can be adjusted in the "System Options" dialog. Maximum: 2400Hz, default: 1200 Hz. At a sampling rate of 19200 Hz this means the task would be started after every 16th measured value.
- External –SystemEvent
The task is started when a PMX system event occurs (the events also appear in the system log of the device). The number of the event is returned in the task by the library function (getSystemeventNr). System events can be called from the browser using device path <name of pmx device>/data/systemevent.xml
If possible, select only these task types.
Cyclic data replaced with the PMX firmware appears as follows:
- Double-click on the left side of project tree "Device (CODESYS Control HBM PMX V3)". Select the "Internal I/O Mapping" tab.
- To connect with an existing program variable of the same type, double-click in the desired cell in the "Variable" column.
CODESYS in PMX contains WebVisu. It can be used to view and control the process from a web page that users can personalize to suit their preferences. The web server runs in CODESYS in PMX.
- In the project tree, right click on "Application". Then "Add Object" – "Visualisation"
- Now graphical elements can be added and connected with program variables. Example:
- After WebVisu is started in PMX, the web page of a browser can be reached at pmx:8080/webvisu.htm "pmx" is the device name. It may have to be replaced by the actual device name or an IP address. "webvisu.htm" is the standard name in CODESYS. It can be changed in the Visualisation Manager.
- WebVisu is linked by the PMX user interface via the CODESYS icon in the footer. The standard name "webvisu.htm" must be used for the link to work.
The device can be operated with Codesys as a CAN-Open slave or master. To do this, first a CAN component must be added, then a CAN-Open stack. The package included with delivery contains several relevant examples.
Be sure to make use of the knowledge and information available in the Codesys Store. You'll find plenty of examples of programs and solutions there covering a wide range of tasks.
These examples are simply for the purpose of illustration. They cannot be used as the basis for any warranty or liability claims.