Is there a limit to how much data you place in a table?

Page: < 12 Showing page 2 of 2
Access is Denied
  • Total Posts : 7670
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
RE: Is there a limit to how much data you place in a table? 2008/01/16 07:27:02 (permalink)
Add these modifications:

    movlw high(display_data_1)
    movwf PCLATH
    call  display_data_1   ;grabs eight bits for the first lot of 8 leds
;    movlw high(display_data_2)
;    movwf PCLATH
    call  display_data_2   ;grabs eight bits for the second lot of 8 leds
    movlw high(display_data_3)
    movwf PCLATH
    call  display_data_3   ;grabs eight bits for the third lot of 8 leds
;    movlw high(display_data_4)
;    movwf PCLATH
    call  display_data_4   ;grabs eight bits for the fourth lot of 8 leds
    clrf  PCLATH
    call  delay2
    goto  begin
delay2                          ;move delay2 to here
    org   0x0E00
display_data_1                  ;each table routine uses 124 program memory words
    movf  pc_display_data_1,w
    incf  pc_display_data_1
    addwf PCL
    retlw b'00100000'           ;1st data
    retlw b'00000000'           ;119th data
    clrf  pc_display_data_1   ;120th data entry point
    retlw b'00000000'           ;120th data

    org   0x0E80
    org   0x0F00
    org   0x0F80
post edited by 1and0 - 2008/01/16 18:05:03
P Lameijn
Super Member
  • Total Posts : 1914
  • Reward points : 0
  • Joined: 2004/01/22 18:30:23
  • Location: The Netherlands
  • Status: offline
RE: Is there a limit to how much data you place in a table? 2008/01/16 08:00:23 (permalink)
You should use w and f as destination to keep things readable.

incf    pc_display_data_1, f
btfsc   status,c      ; <-- add these two lines
incf    pclath,f         
movf    pc_display_data_1, w 
addwf   pcl
retlw   b'00100000' ;from here down is another 119 retlw statements..
movlw   h'00'
movwf   pc_display_data_1

Stefan Uhlemayr
Super Member
  • Total Posts : 4292
  • Reward points : 0
  • Joined: 2005/05/12 12:25:46
  • Location: Germany
  • Status: offline
RE: Is there a limit to how much data you place in a table? 2008/01/16 14:11:10 (permalink)
ORIGINAL: Olin Lathrop

    __config 0x3f98
    cblock 0x20
    org 0x0000

And looks like a mess with opcodes starting in column 1.

No thanks.

Hm, I think you shouldn't be so hard in this casewink. Of course, "relocatable code" is much better (especially for the midrange-parts with the annoying rom-paging). And hard-coding the config-bytes (and this without any comments!!!) isn't the right way, too.

But for a newbie (if retrobrad stated correctly, he's writing PIC-code for just one month now) his code is looking pretty good already. The great pity is, that there are so many examples and tutorials and books for the PIC-series written in absolute-code, and if you're looking for references about the relocatable-code, then you'll not find much more then the MPASM-Usersguide (document-number DS33014J) and your pretty useful page of resources ( ).

I think, as the program isn´t too complex, it could be now a good point of time for the OP to change this program into relocatable code. It's really worth doing so!!!

Starting Member
  • Total Posts : 33
  • Reward points : 0
  • Joined: 2007/12/23 20:15:30
  • Location: 0
  • Status: offline
RE: Is there a limit to how much data you place in a table? 2008/01/17 22:37:22 (permalink)
Thanks for all the tips there guys - ive had a busy week at work so this weekend ill be able to get back into some programming and hopefully come up with a good outcome.

I am only new to pics, ive been programming them for about a month and a half now and realise that there are alot of bugs i need to iron out, better techniques to learn etc...
and thats why im thankful for forums like these Smile

thanks very much again, once the project is finished ill be sure to upload some photos!
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2011/01/12 04:26:36
  • Location: BG
  • Status: offline
Re: RE: Is there a limit to how much data you place in a table? 2011/01/14 01:41:11 (permalink)
Hi all .. 
I have some unexpected jump caused by table read. 
The code is working fine for the first 28 bytes in the table, sends normaly the read bytes to USART  and on 29-th byte PC makes unexpected jump. 
simulation is on Mplab  , pic16f648 

Any help with that is welcome ..

    MOVLW     HIGH (MSG_Ea0C)
    MOVWF     PCH_B0
    MOVLW     LOW (MSG_Ea0C)
    MOVWF     PCL_B0
    CLRF         MSGPTR

    CALL        TABLE_READ
    CALL        outch_n     ; output the character
    INCF         MSGPTR,F
    MOVF        MSGPTR,W
    XORLW     D'76'
    GOTO        GMET_1

    MOVF          PCH_B0,W
    INCF           PCL_B0,F
    INCF           PCH_B0,F
    DECF          PCL_B0,W
    MOVWF       PCL

    DT     0x40, 0x40, 0x45, 0x61,  0x0C,  0x17,  0x07,  0xDA,  0x0F,  0x12, 0x37,  0x00,  0x0E,  0xE5,  0x85,  0x09, 0x55,  0xA9,  0xDB,  0x04,  0xE3, 0x3B,  0x13,  0x00,  0x00,  0x9C, 0x50, 0x00, 0x00, 0x00, 0x00,  0x00,  0x08,  0x07,  0x07,  0x00,  0x1B,  0x00,  0x0A,  0x06,  0x0B,  0x08, 0x32,  0xA2,  0x14,  0x00,  0x00,  0x20,  0x11,  0x00,  0x00,  0x20,  0x1F,  0x08, 0x33,  0xA2,  0x17,  0x08, 0x2B,  0xA2,  0x0E,  0x08, 0x2D,  0xA2,  0x20,  0x08, 0x33,  0xA2,  0x18,  0x08, 0x32,  0xA2,  0x20,  0x82,  0x0D,  0x0A  ;  76 bytes including CR LF 

post edited by antonio - 2011/01/18 13:26:56
Page: < 12 Showing page 2 of 2
Jump to:
© 2018 APG vNext Commercial Version 4.5