Maybe you need to make the variable a number of some kind?
My variable is the InChar (look the code) and I set it as a byte.

The possible value could be $a1 or $a2 or $aa.

When I type that value via the terminal I have it back (hserout) but I do not have correct answer from the DS1620.

The strange thing is that I send
$a1

and I receive back
$
a
1