I am using a 750-8111, Codesys 3.5 and need to do a warm reset and have the PLC to restart automatically via a reset push button in a visualization screen.
I have tried Systems events, “StopDone”, but after the PLC restarts, the K-bus icon comes back faulty, and do not recognized none of the installed IO modules. The error says “no driver for devices”, and IO doesn’t work in the code. After cycling the power, the PLC is back to normal.
Here is the current routine I am using to restart the PLC:
// Trigger logic
IF GVL_1.xSFCReset THEN
GVL_1.xSFCReset := FALSE; // Clear trigger
xResetTriggered := TRUE; // Set internal flag for reboot
fbTimer(IN := FALSE); // Reset timer initially
END_IF;
// Wait 1 second before triggering reboot to ensure graceful shutdown
IF xResetTriggered THEN
fbTimer(IN := TRUE, PT := T#10S);
pApp := AppGetCurrent(ADR(hProcess));
IF fbTimer.Q THEN
// Execute Linux reboot command safely
hProcess := SysProcessExecuteCommand2(
pszCommand := (Command),
pszStdOut := (StdOut),
udiStdOutLen := 1024,
pResult := ADR(Result)
);
fbTimer(IN := FALSE);
xResetTriggered := FALSE; // Clear flag to avoid loops
END_IF;
END_IF;
//============ Previous Code ==================================//
I also tried the one below, and gave the the same K-bus error
IF GVL_1.xSFCReset THEN
GVL_1.xSFCReset := FALSE; // Immediately clear trigger
// Obtain pointer to the current application
pApp := AppGetCurrent(ADR(Result));
IF pApp <> 0 THEN
AppReset(pApp, 16#0001); // Warm reset the PLC(16#0001), stops app
END_IF;
END_IF;
Thank you for your assistance