The present invention aims at avoiding a hung-up in the case where a
command is sent from a controller within a printer but there is no
response to the command from the unit side within the printer, due to a
faulty communication or the like, and also in the case where a noise is
introduced in the communication data. In the present invention, based on
a command sent to the unit side, a data amount of a response from the
unit side to this command is predicted, and also a threshold value of
response time is provided (S21), which is the time when from the command
is sent until the time when the response is received. After the command
is sent (S23) until the threshold value of the response time elapses, the
receive data is sequentially stored in the receive buffer up to when the
data amount from the unit side reaches the predicted data amount (S28,
32, 34). If the data amount from the unit side does not reach the
predicted amount even after the lapse of threshold value of the response
time, an error processing is executed (S43, 45, 47).