mb2hal(1)

πŸ“¦
version 2.9.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– mb2hal β€” bestie edition πŸ’–

okay so real talk, this is mb2hal(1), part of the LinuxCNC Documentation set, and it's the manual page for mb2hal β€” a HAL non-realtime component for Modbus. yes she's niche, yes she's iconic, and yes you're gonna understand her by the end of this. let's go πŸ¦‹


✨ NAME ✨

mb2hal β€” a HAL non-realtime component for Modbus. that's the whole name bestie, short and slay πŸ’…


✨ SYNOPSIS ✨

okay so there's two ways to load her, depending on whether you want the default name or a custom one:

Default component name:

loadusr -W mb2hal config=config_file.ini

Custom component name:

loadusr -Wn mymodule mb2hal config=config_file.ini

so if you don't care what she's called, take option one. if you do care (valid, we love a named girl), use -Wn and pick your own. πŸ‘‘


✨ DESCRIPTION ✨

MB2HAL is a generic, non-realtime HAL component whose whole job is talking to one or more Modbus devices. like, she's the social butterfly of your setup fr fr 🫢

she supports both Modbus RTU and Modbus TCP. both of them. no cap. ✨

for even more info, go look at:

http://linuxcnc.org/docs/html/drivers/mb2hal.html

(yes the link is staying exactly as-is, that's just how manpages are πŸ’€)


✨ PINS ✨

okay this is the big section, get comfy, grab a snack πŸ“. the pins depend on which Modbus function you're using, so here's the full rundown, function by function:

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
heads up bestie: NELEMENTS needs to be 1, or PIN_NAMES must contain just one name. don't try to be cute with this one, she will not allow it. πŸ’€

fnct_06_write_single_register:

  • mb2hal.m.n.float β€” float in
  • mb2hal.m.n.int β€” s32 in
ok so this one has rules too: NELEMENTS needs to be 1, or PIN_NAMES must contain just one name. also β€” and this is the important part β€” both pin values are added and limited to 65535 (UINT16_MAX). so the move is to use one and let the other stay open (it reads as 0). don't fight it, just vibe with it. 🌸

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
same energy as before: both pin values are added and limited to 65535 (UINT16_MAX). use one, let the other open (read as 0). periodt. ✨

Each transaction

  • mb2hal.m.num_errors β€” u32 in β€” this one's the error counter. she's keeping score, and honestly, mood. πŸ”₯

okay now the naming lore, because this is where people get confused and I refuse to let that be you:

  • m = HAL_TX_NAME, or the transaction number if that's not set
  • n = the element number (NELEMENTS)

Example:

mb2hal.00.01.int (TRANSACTION_00, second register)
mb2hal.readStatus.01.bit (HAL_TX_NAME=readStatus, first bit)

see how it works? first one is just numbered because there's no HAL_TX_NAME, second one got a cute little name and now she's readStatus. main character naming energy fr fr πŸ‘‘βœ¨


✨ AUTHOR ✨

Victor Rocco β€” the legend, the icon, the moment. we stan. πŸ’œ


✨ LICENSE ✨

GPL β€” go forth and share, bestie. 🫢


okay that's the whole page!! this one came from the Modbus to HAL docs, dated November 20, 2021, and it's page mb2hal(1) in the LinuxCNC Documentation set. go forth and Modbus responsibly, you absolute genius. slay πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from