--- title: "Configure a Boss’nX Modbus datapoint: read and write a register" description: "Read or write a Modbus register from a Boss’nX component: gateway, Unit ID, function codes, data type, scale factor, byte swaps and no-signal alarm." canonical: https://wiki.can-nx.com/en/guides/boss-point-modbus/ language: en product: Boss’nX audience: - administrateur - installateur context: "Boss’nX on a computer: component editor, datapoint using the Modbus protocol" --- # Configure a Boss’nX Modbus datapoint: read and write a register Context: Boss’nX on a computer: component editor, datapoint using the Modbus protocol In the Boss’nX component editor, a Modbus datapoint reads a register of a device reached through a Modbus TCP gateway, writes a command to it or monitors loss of signal. You set the gateway, the Unit ID, the registers and function codes, the value decoding, then how it is presented on the component card. Intended for administrators and installers with **Manage components**, in the relevant supervision, on a computer. To create read-only datapoints in one go from existing configurations, use [the Modbus import from monitoring](https://wiki.can-nx.com/en/guides/boss-import-modbus/) instead. Historical readings independent of components are configured in [Data logging → Modbus registers](https://wiki.can-nx.com/en/guides/boss-modbus-config/). ## Before you start - The Modbus gateway is [declared in Boss’nX](https://wiki.can-nx.com/en/guides/boss-modbus-gateway-create/). - The device’s Unit ID and register table are confirmed by the installer. The examples in this guide are fictitious. ## Add the Modbus datapoint 1. Open **Components** in your bar or through **Menu → Components**, then click the **Edit component** pencil on the card. For a new component, use **Add component**; the name and location are described in [the common form](https://wiki.can-nx.com/en/guides/boss-component-edit/). 2. Click **Add point**, or find the existing datapoint. 3. In the datapoint’s header, choose **Modbus**, then fill in its **Label**. 4. Check its functions in the same header: **Feedback** for reading, **Cmd** for a command. Uncheck **Cmd** if the datapoint should only read. The **Alarm** checkbox is used to monitor loss of signal, described below. 5. Select the **Modbus gateway**. This choice is separate from the component’s general **Gateway**: check the name, address and port shown in the list. 6. Fill in **Unit ID**, an integer from **1 to 247** confirmed for the device. ## Fill in the registers and decoding 1. If the settings are collapsed, click **Show options**. 2. For reading, fill in **Feedback register** and **Function code (read)**. 3. For a command, fill in **Command register** and **Function code (write)**. 4. Choose **Data type**, then review both function codes. 5. Fill in **Scale factor**, the read options and, if needed, **Advanced (swap bytes / words)**, in accordance with the device’s table. | Setting | Choice and check | | --- | --- | | **Function code (read)** | **1 — Read Coils**, **2 — Read Discrete Inputs**, **3 — Read Holding Registers**, **4 — Read Input Registers**. The form suggests code **3**: use the code intended for the register. | | **Function code (write)** | **5 — Write Single Coil**, **6 — Write Single Register**, **16 — Write Multiple Registers**. The list offers all these codes: have it confirmed that the device accepts the chosen write. | | **Data type** | Suggested as **UINT16**. **INT16 / UINT16** take one word; **INT32 / UINT32 / FLOAT32**, two words. Choose the type that matches the device’s encoding. | | **Scale factor** | For a numeric reading, the decoded value is multiplied by this factor; left empty, it equals 1. Fictitious example: **215 × 0.1 = 21.5**. A numeric command applies the inverse conversion: have a non-zero factor and the command range confirmed before sending a command. | | **Poll interval (s)** | Suggested at **10 seconds**, with a minimum of **5 seconds**. Choose a rate suited to the installation. | | **Swap bytes / Swap words** | Checkboxes shown by **Advanced (swap bytes / words)**. Set them according to the byte and word order confirmed for the device, not by successive attempts until a plausible value appears. | | **Save to history (1 pt/min)** | Read option that keeps at most one point per minute. It guarantees neither a measurement every minute nor the recovery of old values. | The **= feedback register** button, whose tooltip is **Reuse the feedback register address**, copies only the read address to the command. Use it only if the device’s table specifies the same address for writing; it does not check write capabilities. The write code is suggested according to the read code and the type: read **1/2 → write 5**; otherwise a one-word type **→ 6**, a two-word type **→ 16**. The **auto:** hint, to the right of this button, shows the type, the suggested code and the number of words. **Changing Data type can replace the write code already chosen.** After each change, review both codes and compare them with the device’s table. ## Choose the presentation and the command ### Numeric value For a datapoint without **Alarm**, explicitly choose **Format d'affichage → Numeric** (display format). With **Cmd**, fill in **Min**, **Max** and **Pas** (step), in line with the allowed commands, then **Display style → + / − buttons (current)** or **Slider**. In read-only mode, these command settings are not offered. **Unit** gives the displayed unit; the Modbus conversion is set in **Scale factor**. For using these controls on the card, see [adjusting a numeric value](https://wiki.can-nx.com/en/guides/boss-command-numeric/). ### Value list Choose **Value list**, then click **+ Add value** and fill in, on each row, the expected number and its **Label**. Remove an unnecessary row with its trash can. With **Cmd**, the style can be **Dropdown (current)** or **Buttons**. In read-only mode, the list translates the received values into labels. ### Boolean value and pulse A datapoint read with code **1** or **2**, or commanded with code **5** without a read register, is treated as boolean. The **Valeur si VRAI** (value if true), **Label si VRAI** (label if true), **Valeur si FAUX** (value if false), **Label si FAUX** (label if false) and **Couleur** (color) settings then replace the numeric options. Check the meaning of the **1/0** values. With **Cmd**, **Pulse (impulse relay)** sends the same value on each press: **1**, or **0** if **Send 0 (instead of 1)** is checked. **Button label (optional)** customizes its text. This setting defines neither a duration nor an automatic **1 then 0** sequence. See [buttons and pulses](https://wiki.can-nx.com/en/guides/boss-command-buttons/). ### Confirmation, tag and pending installation With **Cmd**, check **Confirm command** in the header if needed: a confirmation is then requested before sending from the dashboard. Also check **Tag**, described in [tag management](https://wiki.can-nx.com/en/guides/boss-tags-assign/), and **Pending installation**. This marking is not a command lock; its display is described in [the component card](https://wiki.can-nx.com/en/guides/boss-component/). ## Monitor loss of signal 1. Add a dedicated datapoint or find the intended alarm datapoint, choose **Modbus** and check **Alarm**. 2. Check **Modbus gateway**, **Unit ID**, **Feedback register**, **Function code (read)**, **Data type** and the read settings. 3. Fill in **Poll interval (s)**, then **No signal — delay (s)**. The delay must be at least **three times the polling interval**: for **10 seconds**, the minimum is **30 seconds**. 4. Save, then reopen the datapoint to check both durations. To remove this monitoring, clear **No signal — delay (s)** and save again. As long as the datapoint is marked **Pending installation**, no alarm is created. The alarm reports that no value was received during the delay; the hardware cause still has to be found on the installation. This Modbus form offers only this delay, with no threshold, comparison or severity setting. For a temperature alarm or another need whose settings are not established, contact support. ## Test the reading and save With **Feedback** checked, **Test the reading** reads the register with the settings entered, even before saving. This button does not test a command. To interpret its result, follow [testing and troubleshooting a Modbus datapoint](https://wiki.can-nx.com/en/guides/boss-point-modbus-help/). 1. Leave the last field, then review the settings. 2. Click **Create** or **Save**. The interface returns to the original page. Before saving, **Back** discards the pending changes. After saving, reopen the datapoint, correct it and save again; a command already executed on the installation is not cancelled. ## Check the result 1. Reopen the component and review the settings that were kept, in particular both function codes and the durations. 2. View the component card and compare the displayed value with the expected measurement. 3. For a command, send it from the card and watch the equipment or its feedback. Saving stores the configuration; communication with the device is checked on the installation. ## Troubleshooting - **Create** or **Save** refused, a **Test the reading** message, an inconsistent value or a command with no effect: follow [testing and troubleshooting a Modbus datapoint](https://wiki.can-nx.com/en/guides/boss-point-modbus-help/). - **Min**, **Max** and **Pas** missing: check that **Cmd** is checked, **Alarm** unchecked and **Format d'affichage → Numeric** selected. If the problem persists, contact support@can-nx.com. French labels: **Composants**, **Menu**, **Ajouter un composant / Modifier le composant**, **Ajouter un point**, **Cmd / Re.Etat / Alarme**, **Passerelle Modbus**, **Unit ID**, **Afficher les options / Masquer les options**, **Registre retour d'état**, **Code fonction (lecture)**, **Registre commande**, **Code fonction (écriture)**, **= registre retour d'état**, **Type de données**, **Facteur d'échelle**, **Intervalle de scrutation (s)**, **Avancé (swap bytes / words)**, **Enregistrer dans l'historique (1 pt/min)**, **Absence de signal — délai (s)**, **Tester la lecture**, **Confirmation envoi commande**, **Créer / Enregistrer / Retour**. The labels **Format d'affichage**, **Pas**, **Valeur si VRAI**, **Valeur si FAUX**, **Label si VRAI**, **Label si FAUX** and **Couleur** stay in French; the choices are **Numérique / Liste de valeurs**, **Style d'affichage**, **Slider**, **Menu déroulant (actuel)** or **Boutons**.