Thank you for your feedback. This is the first program I have written. I usually code in Python, C, and C++ so I am trying to learn PLC on my free time. I have just changed my program to a cyclic structure. But am not sure what the syntax is like for structured text. I keep getting the following errors:
Errors:
exited with status 1 (pid 6444)
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:115-4..115-6: error: ';' missing at the end of statement in ST statement.
In section: PROGRAM elevatorProcess
0115: IF floor = destination THEN;
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:115-32..116-15: error: invalid variable before ':=' in ST assignment statement.
In section: PROGRAM elevatorProcess
0115: IF floor = destination THEN;
0116: doorOpen := true;
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:121-4..121-6: error: ';' missing at the end of statement in ST statement.
In section: PROGRAM elevatorProcess
0121: IF doorOpen AND elapsedTime >= 5000 THEN
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:125-4..125-6: error: ';' missing at the end of statement in ST statement.
In section: PROGRAM elevatorProcess
0125: elapsedTime := elapsedTime + T#1S;
C:\User\Desktop\PLC_Projects\Elevator Process\build\plc.st:131-4..131-6: error: ';' missing at the end of statement in ST statement.
In section: PROGRAM elevatorProcess
0131: IF floor > destination THEN
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:135-2..135-4: error: ';' missing at the end of statement in ST statement.
In section: PROGRAM elevatorProcess
0135: UNTIL false;
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:111-5..111-4: error: unclosed 'REPEAT' statement in ST.
In section: PROGRAM elevatorProcess
0111: IF buttonPressed THEN
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:146--1..146-1: error: ';' missing at the end of statement in ST statement.
C:\Users\Desktop\PLC_Projects\Elevator Process\build\plc.st:95-2..95-23: error: unclosed program declaration.
In section: PROGRAM elevatorProcess
0095: PROGRAM elevatorProcess
9 error(s) found. Bailing out!
Here is my revised program:
floor := 1;
doorOpen := false;
REPEAT
IF buttonPressed THEN
destination := floor;
END_IF
IF floor = destination THEN
doorOpen := true;
elapsedTime := 0;
END_IF
IF doorOpen AND elapsedTime >= 5000 THEN
doorOpen := false;
END_IF
elapsedTime := elapsedTime + T#1S;
IF floor < destination THEN
floor := floor + 1;
END_IF
IF floor > destination THEN
floor := floor - 1;
END_IF
UNTIL false;