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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/24/03 01:19
Read: times


 
#39867 - Sample LUT
Responding to: ???'s previous message
Hi,

Look up tables in RAM ? Forget it . Entering them once is pain enough and the right place for them is Code memory.

Just read the following LUT to display an eight digit value based on the Accumulator contents. OK this kind is useful for LUT with less than 256 entries - you know why.

; FND_MAT is used to find the match in a look up table based on the contents
; of ACC when the routine is called. Calls SHO_NUM to display the value.

; Accumulator, DPTR, INDX, are all altered.

FND_MAT: MOV INDX, #0FFH ; Initialize index for look up table
NXTINDX: INC INDX
PUSH ACC ; Save ACC before checking end of table...
CLR C
MOV A, #246 ; Error if 246+ records have been searched
SUBB A, INDX ; and no match was found....
POP ACC
JC ERROR
INC DPTR ; Increment DPTR 8 times for eight digits
INC DPTR
INC DPTR
INC DPTR
INC DPTR
INC DPTR
INC DPTR
INC DPTR
CJNE A,INDX, NXTINDX ; ACC holds raw data. Compare this with INDX.
LCALL SHO_NUM ; Call display routine
RET

ERROR: MOV DPTR, #FAULT ; Point to the message
LCALL SHO_ALPH
RET

I know that 8 DPTR increments look not very professional - but then this was for a student project and easier to drive in the concept.

Fun it was.

Raghu

List of 19 messages in thread
TopicAuthorDate
DS1620. Look-up table?            01/01/70 00:00      
   RE: DS1620. Look-up table?            01/01/70 00:00      
      RE: DS1620. Look-up table?            01/01/70 00:00      
         Internal External memory            01/01/70 00:00      
            RE: Internal External memory            01/01/70 00:00      
   RE: DS1620. Look-up table?            01/01/70 00:00      
      RE: DS1620. Look-up table?            01/01/70 00:00      
   RE: DS1620. Look-up table?            01/01/70 00:00      
      RE: DS1620. Look-up table?            01/01/70 00:00      
         RE: DS1620. Look-up table?            01/01/70 00:00      
         RE: DS1620. Look-up table?            01/01/70 00:00      
   RE: DS1620. Look-up table? / Erik            01/01/70 00:00      
   Sample LUT            01/01/70 00:00      
      RE: Sample LUT            01/01/70 00:00      
         RE: Sample LUT            01/01/70 00:00      
            RE: Sample LUT            01/01/70 00:00      
   RE: DS1620. Look-up table?            01/01/70 00:00      
      RE: DS1620. Look-up table?            01/01/70 00:00      
         RE: DS1620. Look-up table?            01/01/70 00:00      

Back to Subject List