View Single Post
  #10   Spotlight this post!  
Unread 11-02-2004, 22:14
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Problems reading io pins as a group

Quote:
Originally Posted by Rickertsen2
The problem is that you are using bitwise and(&), you should be using logical AND(&&).
the difference is this:

"&" (bitwise and) ANDs each corresponding bit individually.
11110000 & 11111111 = 11110000
10101010 & 10101010 = 10101010

"&&" (logical and) ANDs the entire word at a time. (it will only be true if the two arguements are the same.)
11110000 && 11111111 = 00000000
10101010 && 10101010 = 11111111
I don't believe that's what he's trying to do - he's using the & to mask off the four bits he's trying to read, which is correct.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)