Skip to content

Getting Started

nXPlc runs the same CODESYS Control runtime as the rest of the family, with one difference that changes how you program it: it has no process I/O. You will not find inputs and outputs to map — you will find a CAN bus to open.

The board must already be running the runtime before you open CODESYS.

  1. Download CODESYS_Control_nXPlc.devdesc.xml.
  2. In CODESYS: Tools → Device Repository → Install…
  3. Select the file and confirm.
NamenXPlc
Vendornexo S.r.l.
Device ID167e 2008
Version3.5.20.200
  1. File → New Project… → Standard project.
  2. Choose nXPlc.
  3. An IO module appears under the device node with the local channels — power diagnostics, indicators and die temperature. See IO Mapping.

CODESYS talks to nXPlc over the network. A new board answers on 192.168.1.50: give the PC an address in the same subnet (for example 192.168.1.10, mask 255.255.255.0), then in Communication Settings scan the network or type 192.168.1.50 as the device address. Changing the address, DHCP and the rest are in Ethernet.

At the first login CODESYS asks you to create the administrator user: the board has no default users or passwords. See Users and Passwords.

CAN is used with the standard CODESYS tools, in two ways:

  • Devices in the tree — under nXPlc: Add Device… → CANbus (network 0, same bit rate as the other nodes), then under the CANbus the CANopen Manager and its slaves. This is the way for CANopen.
  • Raw frames from ST — the CAA CanL2 library, with no nodes in the tree: network and bit rate are parameters of the open call.
hDriver := CL2.DriverOpenP(0, 500, FALSE, szMem, ADR(abMem), ADR(eError));
(* ^ ^ *)
(* network kbit/s *)

Both are described in CAN Bus.

In the Library Manager, Add Library…, you need three entries:

LibraryVersionNamespace
CAA Types Extern3.5.17.0CAA
CAA CanL2 Extern3.5.17.0CL2
CAA Can Low Level Imp Extern3.5.17.0CL2I

Adding CAA Types Extern pulls in its dependencies on its own. Without these three, the types CAA.HANDLE, CL2.ERROR and CL2I.COBID do not exist and the project will not compile.

The shortest one that proves the bus is alive:

PROGRAM PLC_PRG
VAR
szMem : CAA.SIZE;
abMem : ARRAY[0..1023] OF DWORD;
hDriver : CAA.HANDLE;
eError : CAA.ERROR;
eState : CL2.BUSSTATE;
END_VAR
IF hDriver = 0 THEN
szMem := CL2.DriverGetSize(0, FALSE, 16, ADR(eError));
hDriver := CL2.DriverOpenP(0, 500, FALSE, szMem, ADR(abMem), ADR(eError));
ELSE
eState := CL2.GetBusState(hDriver, ADR(eError));
END_IF

A non-zero hDriver means the controller is configured and the bus is open. From there, CAN Bus explains how to transmit and receive.

You can have at most 3 cyclic tasks: a fourth one is refused with an error at download or at startup. Priorities are honoured: a higher-priority task interrupts a lower-priority one that is running.

Serial ports for the application. COM2 would land on the CAN controller’s SPI pins and is refused; the other UART is the RS422 bus of the IO-Locali modules. An nXPlc application has no serial ports, and there is no serial log either: diagnostics are read in the device Log in CODESYS.

SIL2 and SoftMotion. They can be inserted in the tree, but the target does not support them. The CANopen Manager works (see CAN Bus); the CANopen Device has not been tested yet.