| | |
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 alarm ansi anti apache approximation array assignment backend beginner binary bluetooth builtin calculator character cmd converter countpasswordentry curved customdialog cx-freeze dan08 data decimals dictionary directory exe file float format function gnu halp heads homework http ideas inches input itunes java leftmouse library line lines linux list lists loop module mouse mysqlquery number numbers numeric output parsing path phonebook pointer prime programming push py2exe pygame python random recursion redirect schedule screensaverloopinactive script scrolledtext software sqlite ssh statictext statistics string strings sudokusolver terminal text thread time tlapse tuple twoup ubuntu unicode urllib urllib2 variable ventrilo webservice wikipedia wordgame write wxpython xlib






