Searching \ for '[PIC]: MPLab - Problem with String Storage' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=mplab
Search entire site for: 'MPLab - Problem with String Storage'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: MPLab - Problem with String Storage'
2000\08\29@033202 by Werner Soekoe

flavicon
face
Hi

I'm trying to store strings in program memory, using MP Lab ver 5.11.02. My
code contains:

org 0x100
DA "This is 16 chars"
DA "This is also 16 "
DA "La la la la la  "

But when I compile the code, and then look at the Program Memory Window,
it contains the following, which I assume is not correct, since I expected a
bunch of
retlw instructions:

0100  2A68          goto   0x268
0101  34F3          retlw  0xF3
0102  1069          bcf    0x69,0x0
0103  39A0          andlw  0xA0
0104  18B6          btfsc  0x36,0x1
0105  1063          bcf    0x63,0x0
0106  3461          retlw  0x61
0107  3973          andlw  0x73
0108  2A68          goto   0x268
0109  34F3          retlw  0xF3
010A  1069          bcf    0x69,0x0
010B  39A0          andlw  0xA0
010C  30EC          movlw  0xEC
010D  39EF          andlw  0xEF
010E  1031          bcf    0x31,0x0
010F  1B20          btfsc  0x20,0x6
0110  2661          call   0x661
0111  106C          bcf    0x6C,0x0
0112  30A0          movlw  0xA0
0113  3661          ???     Illegal Opcode
0114  106C          bcf    0x6C,0x0
0115  30A0          movlw  0xA0
0116  3661          ???     Illegal Opcode
0117  1020          bcf    0x20,0x0

I'm I doing something wrong? How can I resolve this problem???

Thanks!

Friendly Regards,
Werner Soekoe
spam_OUTWernerSTakeThisOuTspamfsl.gov.za

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu>

2000\08\29@045046 by Kevin Blain

flavicon
face
Use DT (define table) instead of DA
not quite sure what DA does - it is probably short for DATA, which stores
the data directly.
{Original Message removed}

2000\08\29@055430 by Quentin

flavicon
face
DA "packs" the data into 14 bit words (asuming you are using a 16C/F),
whereas DT will put it in a table with RETLW XXX. The data then is
stored in the lower 8 bytes and RETLW in the upper 6.
If you don't use a table lookup you can read the memory space (16F87x)
and ignore MEMHI register (contains RETLW).

Quentin


Kevin Blain wrote:
>
> Use DT (define table) instead of DA
> not quite sure what DA does - it is probably short for DATA, which stores
> the data directly.
> {Original Message removed}

2000\08\29@080515 by Bob Ammerman

picon face
DA is for 'Define Ascii', which stores two ascii characters, as 7 bits each,
in each 14-bit value. You then use table reading instructions (on those PICs
which have such a thing) to read the data.

This has the advantage of allowing twice as much ascii text to be stored.

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


{Original Message removed}

2000\08\29@080530 by Olin Lathrop

flavicon
face
> I'm trying to store strings in program memory, using MP Lab ver 5.11.02.
My
> code contains:
>
>  org 0x100
>  DA "This is 16 chars"
>  DA "This is also 16 "
>  DA "La la la la la  "

Unfortunately you didn't say what processor family you are using.  The DATA
directive is for sticking raw data into program memory.  This is pretty
useless on a 12C or 16C unless you like to assemble instructions yourself.
On those devices, the only meaningful way to put constants into program
memory is with RETLW instructions.  For strings you need to use the DT
directive.  It is specifically for building a table of values, which means
wrapping each byte into a RETLW on 12C and 16C devices.

Constants in program memory can be stored in a completely different way on
17C and 18C devices because these have 16 bit wide instruction words and can
read program memory directly at run time.


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

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu>

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