C style strings via DDE

(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 maximum of 100 elements for all other drivers.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal