Patent ID: 6038669
Filing Date: 2000-03-14
Classification: G06F

Abstract:
A power failure compensation method for a PLC wherein the PLC includes a first storing means for storing a data and a user's program obtained when a CPU executes a user's program, a power failure detection means for checking a state of an alternating current power and outputting a power failure generation signal, a program counter for counting each step of a program executed by the CPU, a second storing means for storing a count value of the program counter which is the program step value that the CPU finally executes before the power failure, a third storing means for storing an execution result value of a program obtained in the program step that the CPU finally executes before the power failure, a battery for supplying a direct current power to the second and third storing means, respectively, and a CPU for reading the step value of the program executed before the power failure from the program counter and storing the thusly read value into the second storing means, storing the execution result value of the program finally executed before the power failure into the third storing means, reading the user's program stored in the first storing means and the data stored in the second and third storing means, and executing the user's program from the next step of the finally executed program step, comprising the steps of:detecting a power failure generation signal from the power failure detector and judging a power failure;reading a step value of a program, which is finally executed before the power failure, from the program counter in accordance with a result of the judgment, storing the thusly read step value into the second execution means, and storing an execution result value of the program, which is finally executed before the power failure, into the third storing means;judging whether the power failure occurs during the operation of the PLC when the power failure is recovered; andreading a user's program from the first storing means when the power failure occurred during the operation of the PLC as a result of the judgment, reading data from the second and third storing means, and executing a user's program from the next step of the program step which is finally executed; andinitializing the data in accordance with the user's program read from the first storing unit and setting total steps of the program if the power failure has not occurred during the operation of the PLC.