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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/16/03 11:46
Read: times


 
#58788 - RE: Lookup Table Help
Responding to: ???'s previous message
Mike,

A slight modification (addtion) to Michael code will do the trick.

MAIN:
....
.... <- perform any startup initialization
....
MOV A, P2 ; Following three lines will initialise the variable "old_value"
ANL A, #0x0F ; old_value could be any register say R7
MOV OLD_VALUE, A ;
MAIN_LOOP:
MOV A, P2 ; get the DIP switch value
ANL A, #0FH ; mask to the low 4 bits
CJNE A,OLD_VALUE,MAIN_LOOP ; check if switch setting has changed
MOV OLD_VALUE, A ; if yes, proceed
LCALL DIPSWT_FUNC
JMP MAIN_LOOP

You need not scan continuously, but periodically. Likewise, take care of switch bounce.

regards,

List of 6 messages in thread
TopicAuthorDate
Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      
      RE: Lookup Table Help            01/01/70 00:00      
         RE: Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      

Back to Subject List