A PWM circuit includes a counter, a cycle register, a cycle detector, a
pulse width register, a pulse width detector, an additional pulse width
register, a voltage generator, a selector, and a voltage controller. The
voltage controller controls the selector so as to add a first additional
pulse at a first voltage to the end of a pulse width, based on a cycle
detection signal outputted by the cycle detector, a pulse width detection
signal outputted by the pulse width detector, and a set value indicating
the first voltage of the first additional pulse outputted by the
additional pulse register, thereby deciding a voltage outputted from the
PWM circuit and a period in which the voltage is output.