Help!! how star with a lookup-table

Discussion in 'Programmer's Corner' started by aleaguir, Nov 6, 2006.

  1. aleaguir

    Thread Starter New Member

    Nov 3, 2006
    1
    0
    I need to use a lookup-table to convert voltaje to Temparature using ATMEGA16. The problem is that i don´t how start the Lookup-table.
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    You can place the look-up table in the cseg using .db compiler directive.

    Code ( (Unknown Language)):
    1.  
    2.  
    3. Table7seg:
    4.  
    5.  .db  0xfd,0x90   ;0,1
    6.  .db  0xa7,0xb6  ;2,3
    7.  .db  0x9a,0x3e  ;4,5
    8.  .db  0x1f,0xb0  ;6,7
    9.  .db  0xff,0xfa    ;8,9
    10.  
    11.  
    12.  
    The inset is a lookup table I used to convert the digits 0 through 9 to their equivalent segments in a 7-segment display.

    You can place it anywhere but I suggest you put it at the end of your executable code.

    One more thing, when you access the table you will need to use the LPM - Load from Program Memory instruction.

    hgmjr
     
Loading...