Author Topic: table lookup problem (pic18f)  (Read 1183 times)

0 Members and 1 Guest are viewing this topic.

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
table lookup problem (pic18f)
« on: January 05, 2015, 04:03:17 pm »
Hello.

i have implemented a lookup table for my nokia lcd project. the lookup table consists of bitmap data (7 byte for each character 'see below'). what i need to do is select and display a character based on a BCD value. So for instance; if i had a unpacked BCD value of 00000010 this value would  select entry number '2' in my table data and return with it for display. As it stands, what ever value i throw at my table it displays all of the data on the LCD .i.e.  1234567890.

many thanks Lester

 part of my code below:



 NEXT    movlw   high MY_DATA        ; load font1 H address to tbptrH
            movwf   TBLPTRH
            movlw   upper MY_DATA       ; load font1 U address
            movwf   TBLPTRU
            movlw   low MY_DATA         ; load font1 L address to tbptrL
            movwf   TBLPTRL
            movf    TEMP ,W
            addwf   TBLPTRL

            tblrd   *+                      ;read table entry into TABLAT
            movf    TABLAT,w                ;in WREG
            call    SPI    ; get  data and write out
            incf    TEMP
            MOVLW   -.2
            CPFSEQ  TEMP
            goto    NEXT

           RETURN
   

 

ORG 0x500

MY_DATA

       
   
     db 0x3E,0x7F,0x71,0x59,0x4D,0x7F,0x3E,0   ; '0'
     db 0x40,0x42,0x7F,0x7F,0x40,0x40,0x00,0   ; '1'
     db 0x62,0x73,0x59,0x49,0x6F,0x66,0x00,0    ; '2'
     db 0x22,0x63,0x49,0x49,0x7F,0x36,0x00,0    ; '3'
     db 0x18,0x1C,0x16,0x53,0x7F,0x7F,0x50,0    ; '4'
     db 0x27,0x67,0x45,0x45,0x7D,0x39,0x00,0   ; '5'
     db 0x3C,0x7E,0x4B,0x49,0x79,0x30,0x00,0    ; '6'
     db 0x03,0x03,0x71,0x79,0x0F,0x07,0x00,0   ; '7'
     db 0x36,0x7F,0x49,0x49,0x7F,0x36,0x00,0    ; '8'
     db 0x06,0x4F,0x49,0x69,0x3F,0x1E,0x00,0   ; '9'




      END
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf