A computation unit that is suitable as a computation unit of a programmable logic controller, the computation unit being configured to execute a motion control and a sequence control, the computation unit comprising: a processor; and a memory (104, 106) configured to store a CAM table (520, 521, 522) and a program for performing the motion control using the CAM table (520, 521, 522) in which a displacement of a driven shaft of an electronic cam is associated with each phase of a main shaft of the electronic cam, wherein the processor is configured to, output execution results of the program to an apparatus to be controlled associated with the driven shaft, alter, when receiving a first command for altering at least either one of a plurality of phases or a displacement associated with the phase, at least either the phase or the displacement in the CAM table (520, 521, 522) to a value that is on a basis of the first command, and execute, when the alteration is performed, the program using an altered CAM table (520, 521, 522), and output the execution results to the apparatus to be controlled, characterised in that the processor is further configured to: receive an instruction to select either a first altering mode or a second altering mode, execute, upon receiving the first command if a selection of the first altering mode has been received, the program using the altered CAM table (520, 521, 522) in a period of the electronic cam in which the first command is received and in a period after the period and thereafter, and execute, upon receiving the first command if a selection of the second altering mode has been received, the program using the unaltered CAM table in the period of the electronic cam in which the first command is received and execute the program using the altered CAM table (520, 521, 522) in the period after the period and thereafter. a processor; and a memory (104, 106) configured to store a CAM table (520, 521, 522) and a program for performing the motion control using the CAM table (520, 521, 522) in which a displacement of a driven shaft of an electronic cam is associated with each phase of a main shaft of the electronic cam, wherein the processor is configured to, output execution results of the program to an apparatus to be controlled associated with the driven shaft, alter, when receiving a first command for altering at least either one of a plurality of phases or a displacement associated with the phase, at least either the phase or the displacement in the CAM table (520, 521, 522) to a value that is on a basis of the first command, and execute, when the alteration is performed, the program using an altered CAM table (520, 521, 522), and output the execution results to the apparatus to be controlled, characterised in that the processor is further configured to: receive an instruction to select either a first altering mode or a second altering mode, execute, upon receiving the first command if a selection of the first altering mode has been received, the program using the altered CAM table (520, 521, 522) in a period of the electronic cam in which the first command is received and in a period after the period and thereafter, and execute, upon receiving the first command if a selection of the second altering mode has been received, the program using the unaltered CAM table in the period of the electronic cam in which the first command is received and execute the program using the altered CAM table (520, 521, 522) in the period after the period and thereafter. output execution results of the program to an apparatus to be controlled associated with the driven shaft, alter, when receiving a first command for altering at least either one of a plurality of phases or a displacement associated with the phase, at least either the phase or the displacement in the CAM table (520, 521, 522) to a value that is on a basis of the first command, and execute, when the alteration is performed, the program using an altered CAM table (520, 521, 522), and output the execution results to the apparatus to be controlled, characterised in that the processor is further configured to: receive an instruction to select either a first altering mode or a second altering mode, execute, upon receiving the first command if a selection of the first altering mode has been received, the program using the altered CAM table (520, 521, 522) in a period of the electronic cam in which the first command is received and in a period after the period and thereafter, and execute, upon receiving the first command if a selection of the second altering mode has been received, the program using the unaltered CAM table in the period of the electronic cam in which the first command is received and execute the program using the altered CAM table (520, 521, 522) in the period after the period and thereafter. receive an instruction to select either a first altering mode or a second altering mode, execute, upon receiving the first command if a selection of the first altering mode has been received, the program using the altered CAM table (520, 521, 522) in a period of the electronic cam in which the first command is received and in a period after the period and thereafter, and execute, upon receiving the first command if a selection of the second altering mode has been received, the program using the unaltered CAM table in the period of the electronic cam in which the first command is received and execute the program using the altered CAM table (520, 521, 522) in the period after the period and thereafter.