question about binary and serial info

Steve Holden steve at holdenweb.com
Sun Aug 21 18:53:28 EDT 2005


nephish at xit.net wrote:
> Sorry i am late getting back on this.
> ord() is finally what is giving me what i wanted.
> the vendor told me that what was comming in was an ascii string
> representing hex characters. So i expected when i used the serial
> module
> that what i would be getting was something along the lines of 4A, 3D,
> etc..
> but i got weird characters. So then (with the help of this very thread)
> discovered that i am reading raw bytes. i am supposed to validate the
> bytes as they come in because the message comes in four at a time. and
> i validate each byte
> like this
> var = (validation number)
> a = ser.read(1)
> x = ord(a)
> then to validate : x = (x & var)
> 
> I am really sorry about the confusion. i am really new at this.
> but i am getting what i am supposed to now.
> 
> i dont have the details on the script, because it is at work.
> but i will post it monday.
> thanks for everything.
> i would still be banging my head if not for this thread
> 
Nice of you to provide some feedback, and great that your program in 
understanding the data.

You'll find c.l.py can save you large amounts of time, and before you 
know it you'll be answering other people's questions.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/




More information about the Python-list mailing list