CoDeSys AT question

kaputt

Level-1
Beiträge
100
Reaktionspunkte
10
Zuviel Werbung?
-> Hier kostenlos registrieren
Hi!
Coming from BigS and AWL, I find the ST (SCL) as programming with handcuffs. However I can see benefits from trying to bang it into my old (Papp-)Kopf.

I tried to use this simple AT -command, but It does not work.
Am I using a wrong syntax or is this illegal?

Thanks in advance!
Kaputt
 

Anhänge

  • whAT.PNG
    whAT.PNG
    16,2 KB · Aufrufe: 38
The AT Declaration in CoDeSys is only for Physical Addresses like %IW80 and so on.

To solve Problems like this i use Pointer.

Declaration:

Code:
VAR
    bytARR : ARRAY[0..3] OF BYTE;
    dwHELP : POINTER TO DWORD;

    TEST : DWORD; (* Example *)
END_VAR

Code:
Code:
(* Get the Adress of the Array *)
dwHELP := ADR(bytARR);


(* Read the ByteArray Value in an DWORD *)
TEST := dwHELP^;

(* Write an DWORD Value to an ByteArray *)
dwHELP^ := TEST;


Pay attention to the ^
 
Zurück
Oben