NFC variables

NFC Support system variables give the possibility to read/write from to NFC Tag* using NFC sensor.

Verify that NFC sensor is supported on device in use.

* In this chapter "NFC Tag" refers to card or token read by NFC sensor.

Protocol Editor Settings

Path: ProjectView> Protocols

  1. Click + and select System Variables: the System Variables dialog is displayed.
  1. Select NFC Support from the PLCModels list.
Tag Editor Settings

Path: ProjectView> Config > double-click Tags

  1. To add a tag, click +: a new line is added.
  2. Select System Variables from the Driver list: tag definition dialog is displayed.

 

Element Description Data type
NFC Tag Present

Indicates NFC Tag presence.

0: NFC Tag not detected

1: NFC Tag detected

boolean

Read Only

NFC Error

Report last error detected.

-101 Error reading from NFC Tag
-50 Tag not detected

int

Read Only

NFC Tag UID

Indicates the identifier of NFC Tag, as soon as NFC Tag is detected.

string

Read Only

NFC Text Indicates arbitrary text information in NFC Tag, as soon as NFC Tag is detected. To write on this variable check "Writing procedure" chapter.

string

Read/Write

NFC Max Length Indicates the maximum number in bytes of NFC Text variable, as soon as NFC Tag is detected.

unsignedInt

Read Only

NFC Read Only

Indicates if NFC Tag can be written, as soon as NFC Tag is detected. Possible values are:

0 NFC Tag is not "read only": NFC Text can be written.

boolean

Read Only

NFC Tag UID For Write Indicates the identifier of NFC Tag on which NFC Text will be written.

string

Read Only

Writing procedure
  1. Put NFC Tag near the sensor. The following System Variables will be populated with the values read from NFC Tag:
    • NFC Tag UID
    • NFC Text
    • NFC Max Length
    • NFC Read Only
  2. Copy the value from "NFC Tag UID" to "NFC Tag UID For Write" in order to prepare the writing.
    Note: Copy can be done by executing "Data Transfer" action from "NFC Tag UID" to "NFC Tag UID For Write", or by JavaScript code.
  3. Write new content to "NFC Text" variable:
    • if "NFC Tag Present" is 1, write is tried.
    • if "NFC Tag UID For Write" is different from "NFC Tag UID"or is invalid (empty) write is not performed.
    • if "NFC Tag UID For Write" is equal to"NFC Tag UID" write is performed. New inserted value in "NFC Text" will be written into NFT Tag.