To make a long story short: you need to upload
.exp files, and add
The library can be found in pack1.zip archive at OWEN forum
The PLC110 M02 that was bought in January 2016 worked out of the box. Firmware update was not required.
Before you start programming PRU cores, you need to switch them into free programming mode. This setup should be made just once and it will persist across reboots.
In order to prepare the PLC you need:
PRU0.prgfile to the PLC (and
PRU1.prg, if that is required) via CoDeSys menu
Write file to PLC
Reboot the PLC by shutting down the power
Import .exp code to CoDeSys project
Hardella IDE creates standard
.exp file, that can be imported via CoDeSys
Here’s what will get imported:
- Programs to setup PRU cores (
- Programs for PRU data exchange (
- Enumerations (
ENUM), if used in the program
Remember to add
pruAccessLib.lib library, otherwise the following CoDeSys would appear on the project build
Error 4001: BlinkningLeds_Pru0MemoryTransfer (2): Identifier 'PRU_FB_GET_PARAMETER' not defined
PRU core setup
By default PRU cores do nothing. They process no input and write no output. In order to upload some program, you need to call relevant
In order to do that, add the following code to
BlinkningLeds_Pru0Init(); (* PRU0 code upload*) BlinkningLeds_Pru1Init(); (* PRU1 code upload *) (* PRU cores are started, so you can exchange data now *) BlinkningLeds_Pru0MemoryTransfer(BLINK_3_4_enable:=TRUE); BlinkningLeds_Pru1MemoryTransfer(BLINK_1_2_enable:=TRUE);
You can upload new PRU programs on the fly, however you should do that at safe times only. Of course it is not a good idea to upload a new program while your plant is drilling.
You can call
BlinkningLeds_Pru0Init(); at any time even in the main PLC loop. The program has protection from multiple executions, so it will operate just once.