A program generation apparatus configured to generate a control program for performing control by using an input/output apparatus configured to perform at least one of an input of a signal and an output of a signal, comprising an arithmetic processing device including a display part and an input part configured to accept an operation performed by an operator on a screen of the display part, the arithmetic processing device configured to communicate with the input/output apparatus, wherein
- the input/output apparatus includes a plurality of first terminals to each of which a second terminal of an electrical wiring is connected,
- the arithmetic processing device includes:
- an operation detection unit configured to detect an. operation performed by the operator on the input part;
- a display control unit configured to control the display part;
- a terminal detection unit configured to detect position information including a position of one of the first terminals of the input/output apparatus to which the electrical wiring is connected;
- and
- a setting unit configured to set a position of the first terminal to which a device indicated in the control program is connected,
- the display control unit displays, on the display part, at least one of the control program and a table of symbols indicating the devices included in the control program, and the position information of the first terminal detected by the terminal detection unit,
- the operation detection unit detects a symbol corresponding to the position information of the first terminal and indicating the device specified by the operator, and
- the setting unit allocates the position of the first terminal included in the position information of the first terminal to the symbol indicating the device detected by the operation detection unit.