I think that for most uses the extra byte accessible by TBLRD has no advantage because PSV allows you to access RAM and FLASH transparently. That is, you can create a single procedure/function that uses RAM or FLASH interchangeably. Most projects need less than 32k of constant data, so just one PSV page is enough and you won't need to worry about swapping pages. This way, all your RAM reside at addresses below 32k and your constant data at addresses above 32k, but both addresses fit in the same registers. The function receiving the pointer doesn't need to know where the data is stored. It is possible to store two bytes or one word of constant data in each program word to access via PSV and use the high-byte to store data accessed via TBLRD. It may be inconvenient to define the data interleaved this way, but it may be useful if FLASH is at a premium. Besides, it is more efficient than using TBLRDH+TBLRDL. Best regards, Isaac Em 14/7/2011 01:12, IVP escreveu: > Thanks Isaac, > > below is a working routine based on your advice. I was looking > into fetching methods and PSV was one of those, although I did > get side-tracked by RETLW > >> need to use "tblrd", which is a bit more awkward > I'm using tblrd for internal data movements and ASCII strings > for display. For example > > .macro disps string ;load address of 'string' > mov #\#tblpage(\string),W6 ;upper(address), <23:16> > mov W6,TBLPAG ;into TBLPAG > mov #\#tbloffset(\string),W6 ;high(address) into W6 <15:8> > ;low(address) into W6 <7:0> > call str_proc ;print characters > .endm > > .macro dispf file ;display file contents > mov \file,w0 > call write_d > .endm > > disps str1 > > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ; Process fetched string characters > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > ;W9 low character of 3 fetched > ;W8 high > ;W7 upper > > str_proc: tblrdh.b [W6],W7 ;read 16-23 to W7 > tblrdl.b [W6++],W9 ;read 0-7 to W9 > tblrdl.b [W6++],W8 ;read 8-15 to W8 > ;increment to next address > > next_str: cp0.b w9 ;test if data =3D 0 (end of string) > bra z,str_done ;yes, exit > dispf w9 ;no, print > cp0.b w8 > bra z,str_done > dispf w8 > cp0.b w7 > bra z,str_done > dispf w7 > > ;get next 3 characters > > tblrdh.b [W6],W7 ;read 16-23 to W7 > tblrdl.b [W6++],W9 ;read 0-7 to W9 > tblrdl.b [W6++],W8 ;read 8-15 to W8 > bra next_str ;loop > > str_done: return > > str1: .pascii "Ready" > >> Try to learn the specificities of the 16-bit architecture, don't use it >> just as a beefed-up PIC16 > Of course. Quietly chipping away. The PCL observation still puzzles > me though > > Thanks for the help > > Joe > > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ; Re-define LCD characters > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > redef: mov #psvpage(new_chars),w0 > mov w0,PSVPAG ;point to 'new_chars' page > > bset CORCON,#PSV ;program space visible in data= =20 > space > > mov.b #0b01000000,w0 ;send data to CGRAM > call write_c > > mov #new_chars,w4 ;base address > clr w5 ;index > mov #16,w6 ;data counter > > get_redef: mov.b [w4+w5],w0 ;fetch data byte from base +=20 > index > call write_d ;write to CGRAM > inc w5,w5 ;index > dec w6,w6 ;data counter > bra nz,get_redef > > return > > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ; Redefined character data > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > .section psv,psv > > new_chars: .byte 0x00,0x02,0x02,0x0a,0x1e,0x08,0x00,0x00 ;carriage retur= n > .byte 0x10,0x10,0x08,0x04,0x02,0x01,0x01,0x00 ;backslash=20 > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .