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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/24/03 06:39
Read: times


 
#59285 - RE: Reading Port Issue
Responding to: ???'s previous message
Since you are sure it is not debounce then why not try this ?

DIPSWT_mode:
MOV A, P2 ; get the DIP switch value
ANL A, #0FH ; mask to the low 4 bits
MOV B, #3 ; setup the table index * 3
MUL AB ; A = table index
RET

The first time you want to read the DIP switches then call the above. Save the table index. Also use it to jump to the correct routine with DPTR.

The next time you want to "insure" that no switch change has happened, then call the above routine again ( take care to save A, B etc )and subtract the previously saved table index. Now if you are sure that the switches have not been changed, then the result MUST be zero.

Anything else is either a loose contact or paranormal!

Raghu


List of 12 messages in thread
TopicAuthorDate
Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
      RE: Reading Port Issue            01/01/70 00:00      
         RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
      RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
   RE: Reading Port Issue            01/01/70 00:00      
   Come back!            01/01/70 00:00      

Back to Subject List