Searching \ for '[PIC]: 16F84 text tables efficiency?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/microchip/memory.htm?key=table
Search entire site for: '16F84 text tables efficiency?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F84 text tables efficiency?'
2000\08\06@073602 by Paul Reilly

picon face
Hi,

I've just starting out with PICS and recently subscribed to the PICLIST.
It's really great to see such high signal to noise ration here, and
already I've seen answers to some things that have been puzzling me...TRIS
regs etc...

Anyway my question is this:

I have a PIC + LCD project that uses lots of text entries. I'm using RETLW
intructions to define the text tables or the even better the MPASM dt " "
macro...

However this seems very inefficient. In machine code each char requires
two bytes. One for the RETLW and another for the char. So my machine code
is filled with 34xx34xx34xx etc. It takes double the number of bytes than
are in the message!

Would it be possible to write my raw char data to a specific location in
the program memory (like 0x300 ) which I know, and then set the PCL to
this to read in x number of chars? It would save a lot of space...

Any ideas, thoughts welcome!

Thanks

Paul

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@084541 by Scott Dattalo

face
flavicon
face
On Sun, 6 Aug 2000, Paul Reilly wrote:

{Quote hidden}

The short answer is that it is not possible to get more efficient utilization
than the RETLW's.

However, if you choose the 16F87x series processors, then you can embed two
7-bit ASCII encoded characters into one program memory location and use the
EEPROM peripheral to obtain access to them. Similarly, if you switch to the
18cxxx family you have the same option except that the program memory is 16-bits
wide.

Scott

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@084753 by Bob Ammerman

picon face
Actually, a 16F84 does _not_ store 2 bytes (16 bits) per instruction, but
rather only 14 bits each. So the waste isn't quite as bad as you thought.

Also, the 16F84 does _not_ allow access to the code memory, except for
executing instructions. Some other PICs, however, do allow reading (and even
writing on flash parts) the code memory.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@115049 by Olin Lathrop

flavicon
face
> I have a PIC + LCD project that uses lots of text entries. I'm using RETLW
> intructions to define the text tables or the even better the MPASM dt " "
> macro...

Just an aside, the DT is not always better than RETLW.  I've found DT to not
always assemble correctly on the 16C family.  I use various table entry
macros that all eventually write RETLW instructions for the 16C family.

> However this seems very inefficient. In machine code each char requires
> two bytes. One for the RETLW and another for the char. So my machine code
> is filled with 34xx34xx34xx etc. It takes double the number of bytes than
> are in the message!
>
> Would it be possible to write my raw char data to a specific location in
> the program memory (like 0x300 ) which I know, and then set the PCL to
> this to read in x number of chars? It would save a lot of space...

What you are asking makes sense on the 17C and 18C families which use 16 bit
instruction words.  In that case you can pack two data bytes into each
program memory location.  These machines also provide instructions for
directly reading program memory.

However, the 16C and 12C families use smaller instruction words and don't
have a means of directly reading program memory (except for some flash
devices like the 16C877).  On those machines, RETLW is the only way to store
arbitrary data in program memory space.

Since you are interfacing to an LCD, I assume you are using a 16C923 or
16C924 because these are the only two PICs that can drive LCDs directly.  (I
wish Microchip would put the LDC module on other PICs, particularly in
combination with a UART, but that's another story).  On those machines,
RETLW is the only choice.

Totally confused now?


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, spam_OUTolinTakeThisOuTspamcognivis.com, http://www.cognivis.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\06@191205 by Tony Nixon

flavicon
picon face
Scott Dattalo wrote:
> The short answer is that it is not possible to get more efficient utilization
> than the RETLW's.
>
> However, if you choose the 16F87x series processors, then you can embed two
> 7-bit ASCII encoded characters into one program memory location and use the
> EEPROM peripheral to obtain access to them. Similarly, if you switch to the
> 18cxxx family you have the same option except that the program memory is 16-bits
> wide.

The DT type saver program can pack 2 ASCII chars into a single PIC word
and it outputs the data in RETLW or DT format.

http://www.picnpoke.com/demo/dtimg.html

--
Best regards

Tony

ICmicro's
http://www.picnpoke.com
.....salesKILLspamspam@spam@picnpoke.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\07@102627 by pandersn

flavicon
face
Paul.....

I seem to recall a thread about three to four weeks ago about a way to
eliminate the RETLW. Didn't save it. Might scan the last month archives.

Phil

On Sunday, August 06, 2000 6:35 AM, Paul Reilly [SMTP:pareillyspamKILLspamTCD.IE]
wrote:
> Hi,
>
> I've just starting out with PICS and recently subscribed to the PICLIST.
> It's really great to see such high signal to noise ration here, and
> already I've seen answers to some things that have been puzzling
me...TRIS
> regs etc...
>
> Anyway my question is this:
>
> I have a PIC + LCD project that uses lots of text entries. I'm using
RETLW
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\08\08@173511 by jamesnewton

face picon face
www.piclist.com/../method/compress/embedded

---
James Newton (PICList Admin #3)
.....jamesnewtonKILLspamspam.....piclist.com 1-619-652-0593
PIC/PICList FAQ: http://www.piclist.com or .org

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...