Enter a MAC address with HMI hex data entry

6 min read · Published November 8, 2026

A MAC address is 12 hex digits, 48 bits, and one 16-bit unsigned register holds only four of them. Set the entry object's data type to unsigned integer with a Hex display format and use three consecutive registers, or take the whole address through a text entry and convert the ASCII in the PLC. Check word order against the target device before writing a live address.

An operator cannot type a full MAC address into one hex entry on an HMI. One entry writes one register, and the 16-bit unsigned register that a hex entry usually targets holds four hex digits, while the address needs twelve. The fix is to split the address or to convert it. Three Numeric Entry objects on three consecutive word registers, each set to an unsigned integer with a Hex display format, take the address four digits at a time. A single Text Entry object takes the whole string and hands the conversion to the PLC. This article sets up both paths, works the arithmetic on a real address, and gives the order check that decides whether the device accepts what was entered.

Why one hex entry cannot hold the address

A MAC address is 48 bits: six bytes at 8 bits each, written as twelve hex digits at 4 bits per digit. A numeric entry on an HMI writes a single data type, and the common width is a 16-bit unsigned integer. Sixteen bits hold four hex digits, a maximum of FFFF, decimal 65,535. Twelve digits need three registers.

Setting the display format to Hex changes what the operator can type and how the value reads on screen; it changes nothing about the register's width. Even the next width up, a 32-bit unsigned integer, holds eight hex digits at most, FFFFFFFF. No single entry of the usual widths carries the address, so the address is split across registers or converted from text.

Recommendation: split the address across three Numeric Entry objects on three consecutive 16-bit registers whenever the target device stores it as words, which is exactly how six bytes sit in three 16-bit words. Use the Text Entry plus a PLC conversion only when the operator must type the whole string in one field and the CPU manual documents an ASCII-to-hex instruction.

What you need

  • The HMI project software, with a Numeric Entry object whose data type sets to unsigned integer and whose display format offers Hex.
  • Three consecutive 16-bit word registers in the PLC, in the order the target device reads them (V-memory addresses, where that is your system's naming).
  • A string tag for the text path, sized to the format you fix in the steps below.
  • A CPU whose manual documents an ASCII-to-hex conversion instruction, listed as ATH on the families that have one; not every CPU implements it.
  • The target device's documentation for its MAC or network settings, which shows the byte order it expects.
  • One test address that contains the letters A to F and a leading zero.

Enter the address as three four-digit hex groups

  1. Create three unsigned 16-bit tags at consecutive word registers, in the order the target device expects. Confirm the type and addresses in the tag list before any object points at them.
  2. Place three Numeric Entry objects on the screen and link them to the three registers, left to right in the same order.
  3. Open each entry's configuration, set the data type to Unsigned, and pick Hex in the display format drop-down.
  4. Label the fields first four digits, second four digits, last four digits. Three identical boxes get filled in screen order, so the screen order must be the register order.
  5. Fix each field at four characters. A display format that starts with the 0 formatting code keeps leading zeros visible, so the first group reads 001A instead of 1A.
  6. Set the entry limits to 0000 through FFFF if your software takes limits on the object.
  7. Download or simulate the project, enter the test address, and read all three registers back from the PLC.

Example: entering 00:1A:2B:03:04:05 into three 16-bit registers

Inputs. The test address is 00:1A:2B:03:04:05, a colon-separated address with letters and leading zeros in the first and last group. The storage is three consecutive 16-bit unsigned word registers, the arrangement this setup uses. Each register holds 16 bits, four hex digits.

Rule. Cut the twelve digits into three groups of four, left to right. Each group is one hex value between 0000 and FFFF and fills one register. Hex is only the display, so each group also has a decimal value.

Arithmetic.

  • Group 1: 001A hex = 0 × 4096 + 0 × 256 + 1 × 16 + 10 = 26.
  • Group 2: 2B03 hex = 2 × 4096 + 11 × 256 + 0 × 16 + 3 = 8,192 + 2,816 + 3 = 11,011.
  • Group 3: 0405 hex = 0 × 4096 + 4 × 256 + 0 × 16 + 5 = 1,029.
  • Check: 3 groups × 4 digits × 4 bits per digit = 48 bits = 6 bytes, one complete address.

Result. The registers hold 26, 11,011 and 1,029 decimal, which read back in hex as 001A, 2B03 and 0405. With Hex active on the entries, the operator types the digits directly and sees them back unchanged.

Decision. The address fits exactly: twelve digits into three registers of four digits, and the widest value a field can take is FFFF, 65,535. A group that needs five digits means the split or the register width is wrong. Write the address to the device only after the order check below.

Enter the whole address as text and convert it in the PLC

  1. Place a Text Entry object and link it to a string tag. Its keypad is alphanumeric, so the operator types digits and the letters A to F in one field.
  2. Fix the string format: 17 characters with the colons kept, 12 with them dropped. Reject any entry of another length before the PLC sees it.
  3. Check the typed characters against the legal set, 0 to 9 and A to F, and reject the entry at the HMI if a character falls outside it.
  4. In the PLC, run the CPU's ASCII-to-hex conversion instruction over the string. On the families that have it, the instruction is listed as ATH, and the manual states its operands and output layout. The conversion of a full address writes three sequential word registers, one per four-digit group.
  5. Inspect the three output registers after a test run and compare them group by group with the address that was typed.

Each character the operator types reaches the PLC as its ASCII code, one character per word or string byte; that layout, and how to read it, is the subject of displaying ASCII from PLC integer words on an HMI. On a controller that runs CODESYS, converting a hex string to a byte array performs the same conversion in structured text. The four-digits-per-WORD arithmetic behind both is worked through digit by digit in converting four ASCII hex digits into a WORD.

Check word and byte order before writing a live address

Three registers reading 001A, 2B03 and 0405 can still reach the device wrong. The device may expect the groups in reverse order, or the two bytes inside each word swapped, so 0405 arrives as 05 04. Settle it from the target device's documentation: if it prints the address byte by byte as 00 1A 2B 03 04 05 and the registers were filled in that order, write the address; if the device's registers read back reversed, swap the two bytes inside each word first. Check the PLC's stored values as well as the screen, because a string that looks right can still be sitting swapped.

The order trap appears whenever one value spans more than one register, including a PLC float stored in two word registers and displayed on an HMI, so settle it once against documentation and leave it alone.

One safety point belongs here. Writing a wrong or duplicated address takes the device off the network. If that happens after an update, restore the last known-good address first to bring the link back, then correct the grouping or the order in the project and retest. Keep the temporary restore separate from the permanent repair.

How to check it worked

Read the three registers from the PLC: for the test address they must show 26, 11,011 and 1,029 decimal, 001A, 2B03 and 0405 in hex. Reconnect the target device, or cycle its power, and confirm it answers at the address that was written. Run one negative test too: type a fifth digit into a hex field, or a character outside 0 to 9 and A to F into the text path, and confirm the project rejects it before anything is written.

Questions

Why does my numeric keypad have no A to F keys?

A calculator-style numeric pad carries the digits 0 to 9, a decimal point and a sign, so it has no way to type a hexadecimal letter. The letter keys appear once the entry object's display format is set to hexadecimal; packages that offer it usually let you edit the same value in binary, decimal or hex. If your panel offers no hex format, use the decimal entry described in the next answer.

Can I enter the groups as plain decimal numbers?

Yes. The register stores bits and hex is only the display, so any four-digit group has a decimal value from 0 to 65,535 that a standard numeric entry can write. For 00:1A:2B:03:04:05 the entries take 26, 11,011 and 1,029. Label each field with both forms, because a technician reading 11,011 on screen needs the label to know which form that value is.

Can one 32-bit entry carry the whole address?

No. A 32-bit unsigned integer holds eight hex digits, a maximum of FFFFFFFF, and the address needs twelve. A 32-bit entry plus a 16-bit entry can carry the twelve digits, but the uneven 8-and-4 split makes order mistakes easy and few devices lay the address out that way. Three 16-bit registers at four digits each match the six bytes exactly.

Why did the device drop off the network after the address write?

Either nothing answers to the address that was written, or the address duplicates another device's and both lose frames. Restore the last known-good address to bring the link back, read the three registers and compare them with the value the device's documentation prints, then fix the grouping or byte order and retest. Confirm the device answers before closing the panel.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote