Reading strings as arrays of ASCII values

When I drag “A” (ASCII) words into FactorySQL I only see 2 characters. How can I read more at once? When I have FactorySQL sitting side by side with RSView, it shows the whole word. RSView shows “Yogurt” and FactorySQL shows “Yo”

An ASCII word is 16 bits, 2 bytes, which would give you 2 characters. It is possible to read more characters by changing your OPC path. In this case we’ll read 20 (10x2)

  1. Drag down A9:0. You should see Yo.
  2. Double click the item. Change The item path from [topic]A9:0 to [topic]A9:0,SC10. You should now see Yogurt

SC is “String, C style”
SP seems to do the same thing “String, Pascal style”
SS is “String, Space-padded”

This post gets into related topics.

From the RSLinx manual under C style strings via DDE:
There is more in the RSLinx help under Generic Item Format

(SC##) indicates a special specifier used only with the Allen-Bradley Integer (N) or ASCII (A) PLC data types for C style strings.

Strings stored in this manner have the end of the string marked by a byte of zero (binary) immediately following the last character in the string.

The ‘S’ indicates string, the ‘C’ indicates C style and the ## indicates the length of the string in elements. Data is read up to the requested length of the string or to the first byte of zero (hex) that is encountered in the string whichever comes first.

You may specify multiple strings with the length (block size) specifier (L##). However, the maximum combination of individual string lengths and the block size must not exceed the maximum size of a packet. For Allen-Bradley this maximum packet size is 100 elements, with the exception of the Allen-Bradley Ethernet driver where the maximum is 1000 elements.

Example 1: A single string request with a length of 10 elements would be 20 bytes (2 bytes/element). The item for Allen-Bradley would be: N7:0,L1,C1,SC10. The string is C style and would appear as CSAMPLE in the data table.

Register (Element) High byte (Hex) Low byte (Hex) High byte (ASCII) Low byte (ASCII)

N7:0 67 83 C S
N7:1 65 77 A M
N7:2 80 76 P L
N7:3 69 0 E
N7:4 x x
N7:5 x x
N7:6 x x
N7:7 x x
N7:8 x x
N7:9 x x

The end of the string is marked with a zero (0 hex) in the low byte of element N7:3. The remaining are unused (“x”). Even though the requested length is 10 elements (20 bytes), only 7 bytes are returned as the string is ended with the zero (0 Hex) in the low byte of register N7:3.

Example 2: Three strings each with a length of 50 elements would be a total of 300 bytes. The item for Allen-Bradley is N7:0,L3,C1,SC50. This has 150 elements (3 strings X 50 elements each) and is only valid with the Allen-Bradley Ethernet driver as it exceeds the 100 element maximum for all other drivers.