---
name: "mb2hal"
section: "1"
platform: "linux"
package: "linuxcnc-uspace"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mb2hal"
---

# mb2hal(1)

HAL non-realtime component for Modbus

## NAME

**mb2hal** - HAL non-realtime component for Modbus

## SYNOPSIS

- Default component name:

  loadusr -W mb2hal config=config\_file.ini

- Custom component name:

  loadusr -Wn mymodule mb2hal config=config\_file.ini

## DESCRIPTION

MB2HAL is a generic non-realtime HAL component to communicate with one or more Modbus devices. It supports Modbus RTU and Modbus TCP.

See  ⟨http://linuxcnc.org/docs/html/drivers/mb2hal.html⟩ for more information.

## PINS

### fnct\_01\_read\_coils:

- **mb2hal.m.n.bit bit out** **mb2hal.m.n.bit-inv bit out**

  ### fnct\_02\_read\_discrete\_inputs:

- **mb2hal.m.n.bit bit out** **mb2hal.m.n.bit-inv bit out**

  ### fnct\_03\_read\_holding\_registers:

- **mb2hal.m.n.float float out** **mb2hal.m.n.int s32 out**

  ### fnct\_04\_read\_input\_registers:

- **mb2hal.m.n.float float out** **mb2hal.m.n.int s32 out**

  ### fnct\_05\_write\_single\_coil:

- **mb2hal.m.n.bit bit in**

   NELEMENTS needs to be 1 or PIN\_NAMES must contain just one name.

### fnct\_06\_write\_single\_register:

- **mb2hal.m.n.float float in** **mb2hal.m.n.int s32 in**

  NELEMENTS needs to be 1 or PIN\_NAMES must contain just one name. Both pin values are added and limited to 65535 (UINT16\_MAX). Use one and let the other open (read as 0).

### fnct\_15\_write\_multiple\_coils:

- **mb2hal.m.n.bit bit in**

  ### fnct\_16\_write\_multiple\_registers:

- **mb2hal.m.n.float float in** **mb2hal.m.n.int s32 in**

  Both pin values are added and limited to 65535 (UINT16\_MAX). Use one and let the other open (read as 0).

### Each transaction

- **mb2hal.m.num\_errors u32 in**

  Error counter

  m = HAL\_TX\_NAME or transaction number if not set, n = element number (NELEMENTS) \
   Example: \
   mb2hal.00.01.int (TRANSACTION\_00, second register)\
   mb2hal.readStatus.01.bit (HAL\_TX\_NAME=readStatus, first bit)

## AUTHOR

Victor Rocco

## LICENSE

GPL
