[Tutor] Re: sending hex data on port

vicki@stanfield.net vicki@stanfield.net
Wed Jun 18 15:58:02 2003


>To me hex is a way to represent an underlying set of
>bits
>00011000 = 0x18
>10001000 = 0x44

>You are trying to write a hex 18 over a serial port. 
>Does that mean
>you want to write a '1' followed by a '8'  That is a
>character one (hex 49)
>followed by an 8 (hex 48)?

>If you are trying to write some bits that have the
>hex value 18, then you
>are probably want to write the character represented
>by 00011000.  Those
>bits equal 24 in base 10.  The matching character is
>chr(24).

>What module are you using?  Does it make sense to say
>port.write(chr(24))?

That might be it. Is there a function that
automatically translates between the 0x18 and the chr
value that I need? I understand how you got the value
and could write my own, but if it already exists.....

--vicki