| ??? 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, |
| Topic | Author | Date |
| 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 |



