Use tmpch as a staging variable for inch, so that inch is not affected
by I/O errors.
Fix some logic errors introduced by the conversion from readpin.c

While here:
- add a space in the printf() for readability
- no need to check for zero divisor, high + low will never be 0.