| | |
need help comparing bits
Thread Solved |
•
•
Join Date: Jun 2005
Posts: 39
Reputation:
Solved Threads: 0
i have an interesting project at work going on. here is the challenge.
i am using the serial module to read data from a serial input.
it comes in as a hex. i need to make it a binary and compare it bit by
bit to another byte. They have some weird way they set this up that i
have to compare these things with AND. in other words, if bit 1 is 1
AND bit 1 is 1 then the real value is 1...
long story short. is there a good way to compare bytes, bit by bit with
one of the modules of python. i want to know so i dont get halfway into
developing this and find that there is a much better way to do this
than by hand.
thanks for any suggestions.
sk <><
i am using the serial module to read data from a serial input.
it comes in as a hex. i need to make it a binary and compare it bit by
bit to another byte. They have some weird way they set this up that i
have to compare these things with AND. in other words, if bit 1 is 1
AND bit 1 is 1 then the real value is 1...
long story short. is there a good way to compare bytes, bit by bit with
one of the modules of python. i want to know so i dont get halfway into
developing this and find that there is a much better way to do this
than by hand.
thanks for any suggestions.
sk <><
Great, I managed to put a code snippet together from my C experience. Take a look at it:
http://www.daniweb.com/code/snippet360.html
http://www.daniweb.com/code/snippet360.html
May 'the Google' be with you!
![]() |
Similar Threads
- What's better? Windows 2000 Server or Linux Server? (Windows Servers and IIS)
- help me in accessing bits (C)
- Any artists here using Poser for 3D renders? (Windows Software)
- Essay help:comparing two professions, Software Enginering and ? (Computer Science)
- INCOMPLETE LOADING OF PAGES - "ACTION CANCELED" BITS ALL OVER? (Web Browsers)
Other Threads in the Python Forum
- Previous Thread: Parsing xml file
- Next Thread: How to use 'top' using Python
| Thread Tools | Search this Thread |
abrupt ansi anti apache approximation array assignment avogadro backend beginner binary bluetooth book builtin calculator character code converter countpasswordentry curved customdialog dan08 dictionaries dictionary dynamic examples exe file float format function gnu graphics gui heads homework ideas import inches input java launcher library line lines linux list lists loop mouse mysqlquery number numbers numeric output parsing path phonebook plugin pointer port prime programming progressbar projects py2exe pygame python random recursion redirect scrolledtext software statictext statistics string strings sum table terminal text textarea thread threading time tlapse trick tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable wordgame write wxpython xlib






