??? 10/30/03 09:18 Read: times |
#57501 - RE: More on DIP Switch Code Responding to: ???'s previous message |
Another table metode can be:
<pre> DIPSWT_FUNC: MOV A, P2 ; get the DIP switch value ANL A, #0FH ; mask to the low 4 bits rl a PUSH A MOV DPTR, #TABLE MOVC @A+DPTR MOV B,A POP A INC A MOVC @A+DPTR MOV DPH,B MOV DPL,#0 JMP @A+DPTR ; jump to and through table ; TABLE: DW DIP_SWT_IGNOR ; swt=0 ignore this combination DW DIP_SWT_FUNC1 ; swt=1 go to func 1 handler DW DIP_SWT_IGNOR ; swt=2 ignore this combination DW DIP_SWT_IGNOR ; swt=3 ignore this combination DW DIP_SWT_IGNOR ; swt=4 ignore this combination DW DIP_SWT_IGNOR ; swt=5 ignore this combination DW DIP_SWT_FUNC6 ; swt=6 go to func 6 handler DW DIP_SWT_IGNOR ; swt=7 ignore this combination DW DIP_SWT_FUNC8 ; swt=8 go to func 8 handler DW DIP_SWT_IGNOR ; swt=9 ignore this combination DW DIP_SWT_FUNC10 ; swt=10 go to func 10 handler DW DIP_SWT_IGNOR ; swt=11 ignore this combination DW DIP_SWT_FUNC12 ; swt=12 go to func 12 handler DW DIP_SWT_IGNOR ; swt=13 ignore this combination DW DIP_SWT_FUNC14 ; swt=14 go to func 14 handler DW DIP_SWT_IGNOR ; swt=15 ignore this combination ; DIP_SWT_IGNOR: RET ; exit from subroutine if ignore ; DIP_SWT_FUNC1: ; Function 1 handler ... ... RET ; DIP_SWT_FUNC6: ; Function 6 handler ... ... RET ; DIP_SWT_FUNC8: ; Function 8 handler ... ... RET ; DIP_SWT_FUNC10: ; Function 10 handler ... ... RET ; DIP_SWT_FUNC12: ; Function 12 handler ... ... RET ; DIP_SWT_FUNC14: ; Function 14 handler ... ... RET |
Topic | Author | Date |
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 |