Skip to content

CODESYS NVL

Beta

Exchanges Network Variable Lists (NVL) with any CODESYS-based controller (CODESYS Control, ctrlX PLC, WAGO, KEB and others). It is the UDP interface with the framing CODESYS NVL.

Choose CODESYS NVL (UDP) (beta) in Add Interface to exchange Network Variable Lists with any CODESYS-based controller (CODESYS Control, ctrlX PLC, WAGO, KEB and others). It is the UDP interface with the framing CODESYS NVL (Type: Udp, preset CODESYS-NVL). NVL is cyclic and connectionless: after a controller download or restart the next cycle writes the full state again, so no resynchronisation is needed, and a missing list shows up as a timeout.

Set up in CODESYS

  1. Add a global variable list (GVL) with the property Network variables. Use Pack variables, switch Transmit checksum and Acknowledgement off, and note the List identifier.
  2. A list the controller sends (Sender) is received by CONNECT. A list the controller receives (Receiver) is sent by CONNECT. Set the sender’s target to the CONNECT PC’s address (unicast; broadcast usually does not reach it through routers or virtual adapters) and port 1202.
  3. Open UDP port 1202 in the controller’s and the PC’s firewall.
  4. Export the list with Link to file (*.gvl).

CODESYS and CONNECT on the same PC. Both cannot bind port 1202, so each side listens on its own port:

DirectionListensSetting
Controller sends (Sender list)CONNECTSender list: target 127.0.0.1, port 1203. CONNECT: local bind address 127.0.0.1, local port 1203
Controller receives (Receiver list)CODESYSReceiver list: port 1202. CONNECT: remote host 127.0.0.1, remote port 1202

If nothing arrives on the loopback address, use the PC’s own network address as the sender target and 0.0.0.0 as the local bind address. This setup is not part of the tested configurations (the interface is verified against a controller on another host).

Import in CONNECT. In the interface’s ⋮ → Edit… dialog choose Import .gvl…, select the file and, if the lists use structures or enumerations, add the TYPE … END_TYPE declarations. The dialog previews the list, its bytes and telegrams and the signals (arrays as Name[i], structure members as Name.Member). Choose whether the controller sends or receives the list and the target interface. Importing again replaces the list with the same identifier and its signals. The import also sets list id, pack, interval and minimum gap from the file. Signals already mapped to a model signal keep the model’s type; a mismatch is listed in the preview and shown as a signal issue, never changed silently.

ParameterDefault
FramingCodesysNvl
Local bind address / port0.0.0.0 / 1202
Remote host / portPLC address / 1202
String encoding (NvlStringEncoding)UTF-8 (alternative Latin-1); WSTRING is always UTF-16LE

Each list is shown as its own block with these fields, followed by a summary line such as 66 bytes, 39 variables, 1 telegram:

FieldUnitDefaultMeaning
Name-from the fileName of the list, for display
List ID-1CODESYS list identifier, unique across both directions
Direction-Receive (PLC sends)Receive (PLC sends): the controller sends the list. Send (PLC receives): CONNECT sends it
Pack variables-onCODESYS Pack variables
Interval (ms)ms50Send: cyclic interval (0 = off)
Send on change-offSend: additionally when a value changes
Min. gap (ms)ms20Send: minimum distance between two telegrams sent on change
Timeout (ms)ms1000Receive: no complete list for this long marks the data stale (0 = off)

Signal addresses are <listId>/<offset>:<TYPE>, for example 1/0:BOOL, 1/2:INT or 2/0:STRING(80). The offset is the byte offset in the list’s data, counted without padding. In this form INT is the 2-byte IEC INT, unlike the raw UDP address where INT is 32 bits.

IEC typeSizeSignal type
BOOL, BYTE, SINT, USINT1 byteBool (BOOL) or Int
WORD, INT, UINT2 bytesInt
DWORD, DINT, UDINT, TIME4 bytesInt (UDINT above 2 147 483 647 is reported as out of range)
REAL, LREAL4 / 8 bytesFloat (LREAL loses precision)
STRING(n), WSTRING(n)n+1 / 2·(n+1) bytesText, n = 1…255

LINT, ULINT, LWORD, LTIME, DATE, TOD and DT are counted in the layout so later offsets stay correct, but get no signal.

Behaviour. Lists are matched by identifier only, never by sender port. CONNECT publishes a received list once every telegram of it has arrived. If a list stays silent longer than its timeout, the interface shows an error naming the list; it returns to Connected when every list is healthy again and sends all send lists once immediately. While a list is silent, the model in the browser stays in PLC mode and keeps the last received values; it does not switch to simulation (see Simulation or PLC). Send lists are also sent once right after connecting. Writing needs Allow writing to the partner.

Limits. Transmit checksum and Acknowledgement are not supported: switch them off (received telegrams with the checksum flag are accepted and reported as unverified). A single item larger than 256 bytes cannot be transmitted by CODESYS either. Lists are limited to 65 535 bytes. Controllers with big-endian byte order are not supported. A list whose layout differs from the import is reported as a layout mismatch: import the .gvl again.

Version compatibility: CONNECT 1.11 or newer is required; release CONNECT before realvirtual. With an older CONNECT the preset, the framing selection and the import are not offered, and an NVL configuration copied into an older CONNECT shows every signal as an address error.

  • Manually. First import the .gvl, which creates the list and its layout. Signals then use the address form <listId>/<offset>:<TYPE>, for example 1/0:BOOL, 1/2:INT or 2/0:STRING(80). The offset is the byte offset in the list’s data, counted without padding.
  • Browse. No browse: NVL is cyclic and connectionless, so there is nothing to ask the controller. Use the .gvl import instead.
  • File import. Yes. Import .gvl… (in the interface’s ⋮ → Edit… dialog) reads the *.gvl file exported with Link to file in CODESYS and previews the list, its bytes and telegrams and the signals before anything is created.
  • Export from the model. When the model exists before the controller project, let it write the lists: Export .gvl… (in the interface’s ⋮ → Edit… dialog, next to Import .gvl…; save the interface first) creates two CODESYS list files from the PLC signals of the open model. The PLC outputs become the list the controller sends (Sender), the PLC inputs the list it receives (Receiver). The dialog shows per list the variables, bytes and telegrams, lets you leave signals out and sets the list identifiers, the interval and the sender’s target address; ports come from the interface (the sender list uses CONNECT’s local port, the receiver list the remote port). Signals map to BOOL, DINT and REAL or LREAL; a signal of another type or with a name CODESYS cannot use is listed with the reason and left out. With Also create these lists in the interface the same lists and signal addresses are created in CONNECT in one step, so model, gateway and controller share one layout. In CODESYS, add the receiver file as a Network Variable List (Receiver) with Import from file, and link the sender file to a Network Variable List (Sender) with Link to file; then check the sender’s list identifier, port and target address in the list properties. An AI assistant gets the same result from the command connect.nvlExport.
  • From the model. Use Addresses → Import address table… in the signal-mapping section of the CONNECT panel: a CSV or TSV with name;address[;dataType[;topic]] rows, where the name is the model’s signal name. New signals take direction and type from the same-named model signal; signals that already exist keep their configured type. Fill from controller… has nothing to match, because this protocol cannot be browsed. See Configuring interfaces.

How direction, data types and write access are decided is explained in Common concepts and Configuring interfaces.