IMDTouchKnowledge BaseShop main store

How-to

Decoding SLC N-File ASCII and Bit Arrays in FactoryTalk View ME

HMI and touchscreens Published 6 min read

Short answer

20549 is hex 0x5045, the packed ASCII bytes for P and E — correct data read as an integer because FactoryTalk View ME has no Character Array object. Rebuild the text on a string-capable mapping (on ControlLogix, COP the bytes into a String tag's .DATA and set .LEN), and extract two-bit multistate codes with AND masks 3, 12, 48, 192 shifted right 0, 2, 4, 6.

On this page
  1. Read 20549 as packed ASCII before changing anything
  2. Why the conversion dropped the text
  3. Rebuild the text on a string-capable mapping
  4. Copy the bytes into a ControlLogix String tag
  5. Pull two-bit multistate codes out with a mask and shift
  6. Decide panel decode or controller decode
  7. Verify each decode against controller memory
  8. Questions asked

20549 is not corrupted data. It is hex 0x5045, the packed ASCII bytes for P and E, shown as an integer because the converted object lost PanelBuilder32's Character Array interpretation. FactoryTalk View ME has no Character Array object: it renders text from the controller's string data types, so an N-file word full of characters reads as a number. The fix is to rebuild the text on a string-capable mapping — on a ControlLogix target, COP the bytes into a String tag's .DATA and set .LEN — and to pull two-bit multistate codes out of words like N110 with a bitwise AND mask and a right shift. The SLC data itself never changed.

Read 20549 as packed ASCII before changing anything #

An SLC N-file element is a 16-bit integer word. When PanelBuilder32 displayed N107:0 as "PE", it read the word's two bytes as characters: 0x50 in the high byte is ASCII P, decimal 80; 0x45 in the low byte is ASCII E, decimal 69. Assemble the integer: 80 × 256 + 69 = 20480 + 69 = 20549. The value on the new screen is exactly the bytes the old terminal rendered as text.

The 20-character array at N107:0 spans 10 words. The stored message on this machine is "PE Resine": N107:0 holds "PE", N107:1 holds the space and "R", N107:2 "es", N107:3 "in", and N107:4 "e" with one byte unused. A 9-character message ends one byte into the fifth word, so the low byte of that word and the words after it are padding. Record all ten words before mapping anything, because the unused final byte of an odd-length message is the detail that breaks a two-characters-per-word assumption.

Why the conversion dropped the text #

The PanelBuilder32 object was Data Type Character Array at register N107:00 with array size 20. The converter produced a text box whose variable marker changed from /A:20 Last_Comp_CM1/ to /S:20 Last_Comp_CM1/: the A became an S, so the object now claims string-typed data. Rockwell's PanelView to PanelView Plus migration guide documents what conversion does: PanelBuilder32 tag names and addresses are converted, and a character array's size is converted to the platform's maximum string length of 82.

That is where the text broke. FactoryTalk View ME displays text from string data — ST files on the SLC and PLC-5 platforms, String tags on ControlLogix — and N107 is an integer file, so a string-style reference to it shows the first word's integer value. Work through every converted object the way you would when validating HMI variables during a software migration: compare tag name, data type, address and length against the PanelBuilder32 source. The marker swap is a flag to inspect, not proof of a working binding.

Rebuild the text on a string-capable mapping #

  1. Open the converted object and record the tag name (Last_Comp_CM1 here), the data type it now uses, the controller address and the fixed character count. Compare against the source: start N107:0, 20 characters.
  2. Read N107:0 through N107:9 and write down each word's two bytes, high byte first on this installation, including the padding after the last character.
  3. Choose the string representation the target supports: an ST string element on the SLC that the panel references directly, or a String tag fed from logic on ControlLogix. If the packed N-file bytes cannot be exposed as string data where the panel reads, build that conversion deliberately in the controller rather than stretching a numeric object.
  4. Point the converted object at the string tag and keep the fixed character count at 20 to preserve the field width.
  5. Download and compare the displayed text against the words recorded in step 2.

Copy the bytes into a ControlLogix String tag #

A 20-character message occupies 10 INT words, which is 20 bytes. Call the String tag RecipeName for this example. Set a COP instruction with the source at the integer array holding the text and the destination at RecipeName.DATA[0]. The documented COP rule is that Length counts destination elements, and each .DATA element is one byte, so Length = 20 moves the whole message: 20 elements × 1 byte = 20 bytes. Then move the character count into RecipeName.LEN — write 9 to display "PE Resine" trimmed, or 20 to keep the full fixed-width field. A String tag holds up to 82 characters, so a 20-character field fits with room to spare. Point the converted text object at RecipeName and the message renders instead of the raw integer.

Pull two-bit multistate codes out with a mask and shift #

The second legacy construct is the Bit Array. The tag Ind_CM1_Drop_A points at N110:001/00 with array size 2: two bits, bits 00 and 01 of the word, encoding a four-state indicator. The next indicator takes bits 02 and 03 of the same word, and the pattern continues — eight two-bit fields in one 16-bit word. The expressions below read the containing word, shown here as N110:0. Each mask is 3 shifted left to the pair's starting bit, and the right shift drops the masked pair down to bits 00–01:

Bit pair Mask Shift Expression
00–01 3 0 {::[Shortcut]N110:0} & 3
02–03 12 2 ({::[Shortcut]N110:0} & 12) >> 2
04–05 48 4 ({::[Shortcut]N110:0} & 48) >> 4
06–07 192 6 ({::[Shortcut]N110:0} & 192) >> 6
08–09 768 8 ({::[Shortcut]N110:0} & 768) >> 8
10–11 3072 10 ({::[Shortcut]N110:0} & 3072) >> 10
12–13 12288 12 ({::[Shortcut]N110:0} & 12288) >> 12
14–15 49152 14 ({::[Shortcut]N110:0} & 49152) >> 14

Worked example: set field 02–03 to binary 10 (code 2) and field 08–09 to binary 11 (code 3), all other bits zero. The word value is 2 × 4 + 3 × 256 = 8 + 768 = 776. The second indicator evaluates (776 & 12) >> 2 = 8 >> 2 = 2, so it shows state 2. The fifth evaluates (776 & 768) >> 8 = 768 >> 8 = 3, state 3. The first evaluates 776 & 3 = 0, state 0.

Each expression returns a plain 0 through 3, so configure the multistate indicator's states 0–3 and assign images from the machine's documentation. On this machine the mapping was 00 = off, 01 = fault on, 10 = not possible, 11 = flash fault on — that mapping belongs to this application, not to the instruction set. If an indicator carries fault states, treat a screen reading off on a machine you know is faulted as a decode problem until you read the raw word; never clear or restart a machine on the panel's displayed state alone.

Decide panel decode or controller decode #

Commit to the panel expression when the SLC program is extensive and built on indirect addressing, as this one is: the expression changes nothing in the controller, adds no tags, and keeps the original tag reference, which is why the mask-and-shift route was accepted here. Move the decode into the PLC when anything other than that one screen object reads the decoded value, or when the next programmer has to maintain the mapping — this site did exactly that for one indicator, combining its two bits in the PLC into a new integer the panel displays directly. The deciding question is who reads the value: one reader, panel expression; shared value, controller integer.

Verify each decode against controller memory #

  1. With the machine stopped, confirm a known word: N107:0 holding 0x5045 must display "PE". If the screen still shows 20549, the object is still numeric.
  2. Toggle one two-bit field through 00, 01, 10 and 11 and confirm the state image changes at each step; repeat for every field you remapped.
  3. On the string path, change the message once and confirm .LEN follows the new content.
  4. Leave recipe and fault logic untouched while you test — a display-path fix never requires the controller data to move.

Test one known input against one expected output at a time, the same discipline as testing HMI simulation against a live PLC.

Questions asked

How do I confirm the other words are packed ASCII and not garbage?

Convert each word to hexadecimal and split it into bytes. The word holding es is 0x6573: 101 × 256 + 115 = 25971, where 0x65 is e and 0x73 is s. If every word's high and low bytes map to printable ASCII that spells your message, the data is intact and only the display mapping is wrong.

Why did the converted object keep 20 characters if the guide mentions 82?

The 82 in the migration guide is the maximum string length the platform supports, which is what a character array size converts to. The 20 in the variable marker is the field width the old screen used. The display keeps that fixed character count while the underlying data type changes from character array to string, so both numbers can coexist on one object.

What happens to the string length when recipes change at runtime?

The .LEN value must track the current message, and that is a controller responsibility. If logic writes a new recipe name into .DATA but leaves .LEN at the old count, the display shows fragments of the previous message or truncates the new one. For a fixed-width field, rewrite the length every time the bytes are copied.

Is there a way to decode the bits without editing an expression on every indicator?

A macro can combine the two bits, but it creates a new tag for each indicator, which is exactly what the expressions avoid: the expression reads the original word on the Connections tab of the indicator object and keeps the original tag reference. Edit the expression once per indicator; add tags only when logic also needs the decoded value.

Do the mask numbers change above bit 15?

Within one 16-bit word they cannot go higher: the last pair uses mask 49152 with a right shift of 14. A ninth two-bit field lives in the first two bits of the next word, so its expression reads that word with mask 3 and shift 0, starting the pattern over.

Keep reading

  • How-to

    One FactoryTalk View ME Project Builds One PanelView Runtime

    One FactoryTalk View ME project creates exactly one .mer runtime, and that runtime runs on one PanelView Plus terminal. Two terminals therefore take the same .mer loaded on both, or two separate projects. For one controller and two identical 2711P terminals, build once and load twice; split into two projects only when screen size, resolution or communication targets differ.

    HMI and touchscreens

  • How-to

    Display large PLC array history on an HMI with a buffer page

    Put a display buffer in the PLC sized to one visible page (10 rows here) and let the HMI show only that. On each page change the PLC clamps a start index and copies the requested slice of four 5000-entry test arrays plus a timestamp array into five 10-element buffers, so 1000 exposed entries become 100 pages and 50 HMI-facing values instead of one object per tag.

    HMI and touchscreens

  • Troubleshooting

    Displaying the 1756-DNB StatusDisplay as text on an HMI

    The 1756-DNB StatusDisplay bytes are ASCII codes stored as numbers, so a string display pointed at the array prints their decimal values. Copy Local:2:StatusDisplay[0] into a controller-scoped STRING with a COP length of 4, set the string's LEN member to 4, and point the HMI string display at that STRING over the Ethernet shortcut — no DeviceNet mapping needed.

    HMI and touchscreens

Why FactoryTalk View Studio Pop-Ups Render Clipped on Windows 11