gordonkeller360 - 2 days ago

I have a program which sequentially places byte representations of characters from a string into an array.

FUNCTION_BLOCK MoveBytesFromString
VAR_IN_OUT
    abRxBuf: ARRAY [0..79] OF BYTE;
END_VAR
VAR
    testString : STRING := '$0A$R$L$TTesting,123...$94$86$0A';
    iCount: DINT;
END_VAR
----------------------------------------------------------------------------------------
// clear the buffer
MEM.MemFill(ADR(abRxBuf), 80, 0);

FOR iCount := 0 TO LEN(testString) - 1 DO // account for undesired null terminator of string
    abRxBuf[iCount] := testString[iCount];
END_FOR

Escaped characters, like $T, $N, etc. work just fine, and so do their hex representation counterparts ($09, $0A, etc). However, when I put something like $94, I get a set of nonsense values... see image attached after one spin of the program.

Could someone explain to me what is happening here? I'll continue to investigate...