User Manual

Lenze · Controller | Parameter setting & programming · Reference Manual · DMS 1.5 EN · 04/2014 · TD17 62
7 Programming with the »PLC Designer«
7.4 Controller c300/p300: Access to odd Controller addresses
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7.4 Controller c300/p300: Access to odd Controller addresses
Examples:
When variables of the DWORD/DINT data type are accessed (read/write), the memory address
must be divisible by 4.
When variables of the WORD-/INT data type are accessed (read/write), the memory address
must be divisible by 2.
Access to other memory addresses causes exception handling of the runtime (exception).
Different response of the PLC program (3200 C/p500 and c300/p300)
1. In the case of the Controllers 3200 C/p500 with x86 processors, unlimited access to the memory
addresses is possible. Due to the different processor (Cortex™-A8), PLC programs cause
exception handling of the runtime on the Controllers A8c300/p300, although they run without
fault on the Controllers 3200 C/p500.
Note!
Due to the processor type (Cortex™-A8), write/read access of variables is only possible to
memory addresses that are divisible by the variable size.
PROGRAM PLC_PRG
VAR
aByteArray : ARRAY [0..20] OF BYTE;
dwDword : DWORD;
wWord : WORD;
pDwordPtr : POINTER TO DWORD;
pWordPtr : POINTER TO WORD;
END_VAR
// Prerequisite: pDwordPtr is divisible by 4
// DWORD-access to an address which is not divisible by 4 => crash on ARM
// processor
pDwordPtr := ADR(aByteArray[2]);
dwDword := pDwordPtr^;
// WORD-access to an address which is not divisible by 2 => crash on ARM
// processor
pWordPtr := ADR(aByteArray[1]);
pWordPtr^ := wWord;