Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/29/03 05:09
Read: times


 
#57421 - Need Help reading DIP switch
I'm a beginner with the 8051, and am looking for advice on the best way to read the status of a 4 position DIP switch. I'm using Port 2, and as it is now I am setting P2 high, then reading it into the accumulator and calling a different subroutine based on whether the value matches my desired combinations of switch positions.

For example, a result of #00001011 would indicate that the first, third, and fourth switches are on. From there I subtract the value from 1111 and jump if not zero to the next test where I again read it in, subtract it from 1111 and jump if not zero.

It seems like I'm going through too many steps though. Is there any simpler, or shorter way to do it?

Thanks..

Jake

List of 13 messages in thread
TopicAuthorDate
Need Help reading DIP switch            01/01/70 00:00      
   JMP @A+DPTR instruction could help            01/01/70 00:00      
      RE: JMP @A+DPTR instruction could help            01/01/70 00:00      
         one more way of doing it            01/01/70 00:00      
      RE: JMP @A+DPTR instruction could help            01/01/70 00:00      
   RE: Need Help reading DIP switch            01/01/70 00:00      
      RE: Need Help reading DIP switch            01/01/70 00:00      
      RE: Need Help reading DIP switch            01/01/70 00:00      
         RE: Need Help reading DIP switch            01/01/70 00:00      
         RE: Need Help reading DIP switch            01/01/70 00:00      
            RE: Need Help reading DIP switch            01/01/70 00:00      
            RE: Need Help reading DIP switch            01/01/70 00:00      
   RE: Need Help reading DIP switch            01/01/70 00:00      

Back to Subject List