Skip to main content
Submitted by Larry Young on Thu, 05/18/2017 - 12:48

We communicate with the 1410 in our product by writing to and reading from the data and control ports. After writing a command (e.g. "TP;") how can I be certain that I have read all the characters of the response? The existing code (which I inherited) does this:

write( "TP;" );
while ( !data_is_ready )
; /* NOP */
while ( data_is_ready )
result_array[ index++ ] = inportb( dataport );

Of course this works when the response is only one character ( ':' or '?') but it sometimes fails when the response is long. The variable-length responses to the "TC1;" command are a problem. Do I need to have separate cases for the various types of commands: the simple commands returning only a success/fail one-byte message; the inquiry commands that return numerical values; and the error-code inquiry? Is there a maximum time specified for the complete response to be ready so I could limit the reading with a timer? Is there an end-of-response character that I missed in the documentation, or a bit in the status register?

Thanks for your help.

Larry Young

Comments 1