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 04:03
Read: times


 
#58783 - Lookup Table Help
Hello...

Thanks all for recent help with dip switch reading. I've taken the code and tried it, but I need some help with jumps and calls.

I'd like it to read the switches, as it does, go to the Mode1, Mode2, etc location, then execute the code, and finally return and run the dip switch code again, over and over. Problem is, the RETs in the mode functions don't seem to be right, since it has nowhere to return to.. moreover, if I put an LCALL DIPSWT_MODE instead of RET, the stack eventually overflows.

What is the proper way to address this program?

Thank you all very much.

Mike

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
MOV DPTR, #TABLE
JMP @A+DPTR ; jump to and through table

;
TABLE:
LJMP IGNOR ; swt=0 no operation
LJMP IGNOR ; swt=1 no operation
LJMP IGNOR ; swt=2 no operation
LJMP IGNOR ; swt=3 no operation
LJMP IGNOR ; swt=4 no operation
LJMP IGNOR ; swt=5 no operation
LJMP MODE5 ; swt=6 go to mode 5
LJMP IGNOR ; swt=7 no operation
LJMP MODE4 ; swt=8 go to mode 4
LJMP IGNOR ; swt=9 no operation
LJMP MODE3 ; swt=10 go to mode 3
LJMP IGNOR ; swt=11 no operation
LJMP MODE2 ; swt=12 go to mode 2
LJMP IGNOR ; swt=13 no operation
LJMP MODE1 ; swt=14 go to mode 1
LJMP IGNOR ; swt=15 no operation
;

IGNOR:

NOP
ACALL DIPSWT_MODE

MODE1:

NOP
RET

MODE2:

NOP
RET

MODE3:

NOP
RET

MODE4:

NOP
RET

MODE5:

NOP
RET

END

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