A method for controlling an automation system having visualization of program objects of a control program of an automation system,
- wherein a controller of the automation system comprises a control program,
- wherein a program state of the control program is stored in a first memory area of the controller, wherein the program state comprises a plurality of program objects of the control program, and wherein the program objects are arranged relative to one another in a predetermined arrangement structure of the program state,
- wherein a memory position and a memory size are assigned to each program object via the arrangement structure, wherein a memory position of a program object defines a number of memory locations by which a program object in a memory area is stored spaced apart from a first memory location of the program state, and wherein a memory size of a program object defines a number of memory locations which a memory object occupies in a memory area,
- wherein the program state comprises at least one pointer element, wherein a pointer object is referenced by the pointer element, and wherein the pointer object is a program object of the control program, and
- wherein a stack of the control program is set up in a second memory area of the controller, wherein program objects are stored in the stack during a runtime of the control program;
- the method comprising:
- executing the control program in an executing step;
- determining a pointer address of the pointer element in a pointer address determining step, wherein the pointer address corresponds to a memory address referenced by the pointer element;
- and
- checking whether the pointer address of the pointer element is located in the first memory area of the program state or in the second memory area of the stack in a checking step;
- if the pointer address of the pointer element is arranged in the first memory area of the program state, determining a first address offset of the pointer address of the pointer element in a first address offset determining step, wherein the first address offset defines a number of memory locations by which the pointer address of the pointer element is spaced apart from a first memory address of the program state in the first memory area;
- and
- identifying a program object which is spaced apart from the first memory location of the program state by the first address offset according to the arrangement structure of the program state as a first program object, the memory address of which in the first memory area corresponds to the pointer address of the pointer element in a first program object identifying step;
- identifying the first program object with the pointer object referenced by the pointer element in a pointer object identifying step;
- determining a fully qualified designation of the identified pointer element in a full designation determining step;
- and
- displaying the fully qualified designation of the pointer object referenced by the pointer element on a display element connected to the controller in a displaying step.