A communication system comprising: a plurality of slave devices; a master device configured to communicate with the plurality of slave devices; and a writing device configured to transfer an ID assignment request to the master device and to the slave devices, wherein the master device includes a plurality of switches (CH21-CH2n), each provided for one of the plurality of slave devices and each configured to supply power to the corresponding slave device, a first switch controller configured to turn on all the plurality of switches (CH21-CH2n) when receiving an ID assignment request and to turn off all the plurality of switches (CH21-CH2n) after a predetermined time has elapsed after turning on the plurality of switches, and a second switch controller configured to turn on the plurality of switches (CH21-CH2n) in sequence after turning off the plurality of switches (CH21-CH2n) by the first switch controller, and wherein each of the plurality of slave devices includes a first storage unit into which upon a receipt of the ID assignment request from the writing device after power is supplied, an event indicative of the receipt of the ID assignment request is stored, a receiver configured to wait for the reception of an ID transmitted from the master device or the writing device, when determining that the receipt of the ID assignment request has been received after power is supplied, and a setting unit configured to set the ID received from the receiver as the own slave ID. a plurality of slave devices; a master device configured to communicate with the plurality of slave devices; and a writing device configured to transfer an ID assignment request to the master device and to the slave devices, wherein the master device includes a plurality of switches (CH21-CH2n), each provided for one of the plurality of slave devices and each configured to supply power to the corresponding slave device, a first switch controller configured to turn on all the plurality of switches (CH21-CH2n) when receiving an ID assignment request and to turn off all the plurality of switches (CH21-CH2n) after a predetermined time has elapsed after turning on the plurality of switches, and a second switch controller configured to turn on the plurality of switches (CH21-CH2n) in sequence after turning off the plurality of switches (CH21-CH2n) by the first switch controller, and a plurality of switches (CH21-CH2n), each provided for one of the plurality of slave devices and each configured to supply power to the corresponding slave device, a first switch controller configured to turn on all the plurality of switches (CH21-CH2n) when receiving an ID assignment request and to turn off all the plurality of switches (CH21-CH2n) after a predetermined time has elapsed after turning on the plurality of switches, and a second switch controller configured to turn on the plurality of switches (CH21-CH2n) in sequence after turning off the plurality of switches (CH21-CH2n) by the first switch controller, and wherein each of the plurality of slave devices includes a first storage unit into which upon a receipt of the ID assignment request from the writing device after power is supplied, an event indicative of the receipt of the ID assignment request is stored, a receiver configured to wait for the reception of an ID transmitted from the master device or the writing device, when determining that the receipt of the ID assignment request has been received after power is supplied, and a setting unit configured to set the ID received from the receiver as the own slave ID. a first storage unit into which upon a receipt of the ID assignment request from the writing device after power is supplied, an event indicative of the receipt of the ID assignment request is stored, a receiver configured to wait for the reception of an ID transmitted from the master device or the writing device, when determining that the receipt of the ID assignment request has been received after power is supplied, and a setting unit configured to set the ID received from the receiver as the own slave ID.