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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/30/03 04:18
Read: times


 
#57489 - More on DIP Switch Code
Thanks for everyones help! It was much more than I expected and has helped tremendously. What I took from all the posts I turned into the following:

CLR A
MOV A, P2.0
JZ mode0
CLR A

MOV A, P2
ANL A,#0FH
SUBB A, #6
JZ mode5
SUBB A, #2
JZ mode4
SUBB A, #2
JZ mode3
SUBB A, #2
JZ mode2
SUBB A, #2
JZ mode1

That looks right to me based on the suggestions, but I have one last problem. The only possible options for my device are DIP switch values of (decimal) 1,14,12,10,8,6 which is why I looked for a 1 right off the start, and then subtracted 6 initially. What I'm unclear about is what will happed if someone selects 16 or 4 or even 2? With 16 I'll start at 10 and only end up at 2 at which point I can just display an error message with a JNZ. But if the switches are set to 4 or 2, will the accumulator immediately be -2 or -4 and just keep going more negative until it hits the JNZ?

Is there a more graceful way to handle those conditions?

THANKS AGAIN EVERYONE.


List of 16 messages in thread
TopicAuthorDate
More on DIP Switch Code            01/01/70 00:00      
   RE: More on DIP Switch Code            01/01/70 00:00      
      RE: More on DIP Switch Code            01/01/70 00:00      
         RE: More on DIP Switch Code            01/01/70 00:00      
            RE: More on DIP Switch Code            01/01/70 00:00      
      RE: More on DIP Switch Code            01/01/70 00:00      
      RE: More on DIP Switch Code            01/01/70 00:00      
         RE: More on DIP Switch Code            01/01/70 00:00      
            RE: More on DIP Switch Code            01/01/70 00:00      
               RE: More on DIP Switch Code            01/01/70 00:00      
                  RE: More on DIP Switch Code            01/01/70 00:00      
      RE: More on DIP Switch Code            01/01/70 00:00      
         RE: More on DIP Switch Code            01/01/70 00:00      
      RE: More on DIP Switch Code            01/01/70 00:00      
         RE: More on DIP Switch Code            01/01/70 00:00      
   RE: More on DIP Switch Code            01/01/70 00:00      

Back to Subject List