Searching \ for 'Ascii constants' 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/index.htm?key=ascii+constants
Search entire site for: 'Ascii constants'.

Truncated match.
PICList Thread
'Ascii constants'
2000\02\09@142414 by Thomas C. Sefranek

face picon face
I'm trying to declare Ascii Strings in the assembler.
Folowing the instructions on page 31:

             data    "Done Initializing."
I get:
Message[303]: Program word too large.  Truncated to core size. (446F)
Message[303]: Program word too large.  Truncated to core size. (6E65)
Message[303]: Program word too large.  Truncated to core size. (6E69)
Message[303]: Program word too large.  Truncated to core size. (7469)
Message[303]: Program word too large.  Truncated to core size. (616C)
Message[303]: Program word too large.  Truncated to core size. (697A)
Message[303]: Program word too large.  Truncated to core size. (696E)
.
.
.
etc


It's trying to pack bytes (8 bits) into a program memory word!

What am I missing?

--
 *
 |  __O    Thomas C. Sefranek  spam_OUTtcsTakeThisOuTspamcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\09@143702 by Quitt, Walter

flavicon
face
I do it this way (with no error messages)

YaYa db "Ya Ya Ya",0

for a NULL terminated ASCII string


{Original Message removed}

2000\02\09@151017 by Thomas C. Sefranek

face picon face
"Quitt, Walter" wrote:

> I do it this way (with no error messages)
>
> YaYa db "Ya Ya Ya",0
>
> for a NULL terminated ASCII string

Error[124]  : Illegal argument (expected single character)
Message[303]: Program word too large.  Truncated to core size. (4400)
0005 0400           00078 Init_Done       DB      'D o',0
--
 *
 |  __O    Thomas C. Sefranek  .....tcsKILLspamspam@spam@cmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\09@164025 by Quitt, Walter

flavicon
face
Looks like you use single ( ' ) quotes.
I use double ( " ).
Singles, I recall are for things like:
J_Char db A'J'
or
Hex_Num db H'FF'
Those define SINGLE bytes
Sequences or Strings of bytes are delimited by double quotes.

What the error message is telling, I believe, is that it is
taking the sequence you want and trying to fit it into the
word size of the processor core you are using.  And it don't
fit so it truncates if for you and tells you about it.

GL,
Walt...

{Original Message removed}

2000\02\09@170522 by Thomas C. Sefranek

face picon face
Message[303]: Program word too large.  Truncated to core size. (4420)
Message[303]: Program word too large.  Truncated to core size. (6F00)
0005 0420 2F00      00078 Init_Done       DB      "D o",0

Notice it cast the white space into an ASCII space (0x20)
so no magic in spaces.

"Quitt, Walter" wrote:

> Looks like you use single ( ' ) quotes.
> I use double ( " ).
> Singles, I recall are for things like:
> J_Char db A'J'
> or
> Hex_Num db H'FF'
> Those define SINGLE bytes
> Sequences or Strings of bytes are delimited by double quotes.

The real problem is the assembler trying to pack 2 characters into a
word!

>
>
> What the error message is telling, I believe, is that it is
> taking the sequence you want and trying to fit it into the
> word size of the processor core you are using.  And it don't
> fit so it truncates if for you and tells you about it.

Yes, I understand that, BUT...
I still can not create a Character string in sequential program memory
words,
(Text) Short of declaring each memory word as Hex.
(I'm beginning to believe it can not be done!)

>
>
> GL,
> Walt...

--
 *
 |  __O    Thomas C. Sefranek  tcsspamKILLspamcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\09@171318 by Quitt, Walter

flavicon
face
I do this ALL the time.
It works great with 16 and 17 series cores using MPASM.
What are you using??????
Perhaps I am using directivess or options that you are
or are not using.  I dunno.  Sorry.

-W

{Original Message removed}

2000\02\09@172525 by Quitt, Walter

flavicon
face
Assuming you are using MPASM
This error is translated in the MPASM USER'S GUIDE as
"Program words for the PIC16C5X may only be 12-bits;
program words for the PIC16CXX may only be 14-bits."
Well that don't make much sense, actually here in this case.
So you and I do something different.  I use MPLAB 4.12.00
My sequence for doing things is:

;********************************************************
display_data code
  global ASCII_STRING

ASCII_STRING db "This is a string!",0

  end ;end of display data

;*******************************************************

I don't even tell MPASM what processor I am using.
So what's the deal?
BTW: The indention is important too.

Now I'm at a loss.
Walt...

{Original Message removed}

2000\02\09@175720 by Alan King

picon face
 It's doing PRECISELY what you told it to do, the problem is you told
it the wrong thing.
 The REAL problem is that YOU'RE trying to put more than one character
in a command that specifically states single chars!  Read the MPASM
user's guide in help, chapter 5 directives for DB and look at the
example.  Look at the example.  db 't', 0x0f, 'e', 0x0f, 's', 0x0f, 't',
'\n'.  Do you notice that every byte is separated?  And that when you
look around in that help, there are several other related commands like
DATA that do make strings?  Can't blame the assembler when you just
haven't passed the RTFM test yet..
Alan


"Thomas C. Sefranek" wrote:
{Quote hidden}

2000\02\09@181215 by Quitt, Walter

flavicon
face
WRONG. RTFM yourself. The syntax:
[<label>] db "<text_string>"[,"<text_string>",...]
IS correct according to the manual.
So:
Init_Done       DB      "D o",0
should be OK.  If Init_Done starts in column 1 and is
not declared (somehow) as something else already.

So there! :-) :-) :-)

{Original Message removed}

2000\02\09@185553 by andy howard

flavicon
face
> WRONG. RTFM yourself. The syntax:
> [<label>] db "<text_string>"[,"<text_string>",...]
> IS correct according to the manual.
> So:
> Init_Done       DB      "D o",0
> should be OK.  If Init_Done starts in column 1 and is
> not declared (somehow) as something else already.
>
> So there! :-) :-) :-)


Interesting. My hardcopy MPASM User's Guide which came with PicStart
Plus (DS33014G - dated 1999) has on page 45:

   DB - Declare Data of One Byte. [<label>] db <expr>
[,<expr>],......,<expr>]
   Description:
   Reserve program memory words with packed 8-bit values. (more details
snipped for clarity,         but see below.)

The example they give is:

   db 't', 0x0f, 'e', 0x0f, 's',  0x0f, 't', '\n'


On the previous page it has:


   DA - Store Strings in Program Memory
   Description:
   Generates a packed 14bit number representing two 7-bit ASCII
characters. This is useful         for storing strings in the memory for
the PICmicro flash ROM devices.

Amid several examples is:

   da "12345678" ,0
   will put 18B2 19B4 1AB6 0000 into program memory.


The previous version, 33014f from the Jan 1999 CD-ROM, makes no mention
of a DA directive AFAICS, but gives the same definition for DB.


The only exception I can find in my manual is when using IDATA to
generate linkable object code when db *can* be used to reserve space in
RAM for strings. (Page 55 of revision G)


Hope this doesn't add too much to the confusion... :>











.

2000\02\10@113651 by Thomas C. Sefranek

face picon face
To continue...

(Since I STILL dont have a working solutin to building ASCII strings...)

"Quitt, Walter" wrote:

> I do this ALL the time.
> It works great with 16 and 17 series cores using MPASM.
> What are you using??????

16C73A(B)

>
> Perhaps I am using directivess or options that you are
> or are not using.  I dunno.  Sorry.
>
> -W
>

--
 *
 |  __O    Thomas C. Sefranek  .....tcsKILLspamspam.....cmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\10@113904 by Thomas C. Sefranek

face picon face
"Quitt, Walter" wrote:

> Assuming you are using MPASM

V02.13

{Quote hidden}

--
 *
 |  __O    Thomas C. Sefranek  EraseMEtcsspam_OUTspamTakeThisOuTcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\10@121155 by Quitt, Walter

flavicon
face
Try the alternative constuct of:

<label> db A'D',A' ',A'0',H'00'

This is valid syntax too.

{Original Message removed}

2000\02\10@125553 by Michael Rigby-Jones

flavicon
face
part 0 6082 bytes
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Well, I have to admitt I've just had a fiddle and it took quite a while to get a simple prog to compile with a constant ASCII string.&nbsp; But I did it.</FONT></P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">test&nbsp;&nbsp;&nbsp; dt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;This is a load of ascii&quot;,0x00</FONT>
</P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Works just fine for me.&nbsp; The assembler choked when I tried to use db.&nbsp; This is the beauty of C, I never get this kind of problems (although plenty of others...)</FONT></P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Mike</FONT>
</P>
<UL>
<P><FONT SIZE=1 FACE="Arial">{Original Message removed}

2000\02\10@141947 by Thomas C. Sefranek

face picon face
part 0 1571 bytes
x-html>  

Michael Rigby-Jones wrote:

 

Well, I have to admitt I've just had a fiddle and it took quite a while to get a simple prog to compile with a constant ASCII string.  But I did it.

test    dt      "This is a load of ascii",0x00

Works just fine for me.  The assembler choked when I tried to use db.  This is the beauty of C, I never get this kind of problems (although plenty of others...)

Mike

YES!  It works!

!!! I just finished re-writing my code to use the return characters in the string.!!!
--
  *
  |  __O    Thomas C. Sefranek  tcs@cmcorp.com
  |_-\<,_   Amateur Radio Operator: WA1RHP
  (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
http://hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org
 

2000\02\10@143236 by Quitt, Walter

flavicon
face
Alright, alright....
Ê
I spent some time with this now.Ê I set the processor to 16C73A
I tried the dt stuff.Ê That sure enough generates table enties.
ent1 dt "123"
assembles to
retlw 0x31
retlw 0x32
retlw 0x33
Ê
string db A'1',A'2',A'3',0x00
assembles to
0x31,0x32,0x33,0x00
bytes in ascending memory.
No useless retlw opcode bytes shoved between them as with dt.
Ê
DONE!

{Original Message removed}

2000\02\10@145932 by Thomas C. Sefranek

face picon face
"Quitt, Walter" wrote:

> Alright, alright....

Thank You Walter.

{Quote hidden}

Yes, but it's a pain to enter!

> DONE!

Indeed!
Thanks to all who assisted!

--
 *
 |  __O    Thomas C. Sefranek  tcsspamspam_OUTcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 Mhz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2000\02\10@151209 by Quitt, Walter

flavicon
face
Using dt for your purpose violates the PIC
mantra of "Thou shalt not waste bytes!"

GL,
Walt...

{Original Message removed}

2000\02\10@180412 by Jason Harper

picon face
> I spent some time with this now.Ê I set the processor to 16C73A
> I tried the dt stuff.Ê That sure enough generates table enties.
> ent1 dt "123"
> assembles to
> retlw 0x31
> retlw 0x32
> retlw 0x33
> Ê
> string db A'1',A'2',A'3',0x00
> assembles to
> 0x31,0x32,0x33,0x00
> bytes in ascending memory.
> No useless retlw opcode bytes shoved between them as with dt.

Without those "useless" retlw opcodes, just what do you think you've
accomplished?  You wouldn't actually be able to read the raw data from the
program memory space, unless you moved up to a 16-bit core PIC with the
TABLRD instruction.  And you haven't saved any space, anyway - an 8-bit
value at the bottom of a 14-bit program memory location takes exactly as
much room as a retlw instruction.

Putting raw text into a 12-/14-bit core is only useful for embedding a
copyright notice into your PIC.
       Jason Harper

2000\02\10@182203 by Quitt, Walter

flavicon
face
Dang, I keep forgetting the mid-range parts are 14 bit memory too.
Stupid me. I've been living in 17C land for too long.
Oh well I keep my strings out in serial eeprom. :-) ;-)

{Original Message removed}

2000\02\11@025549 by Caisson

flavicon
face
> Van: andy howard <@spam@musicaKILLspamspamUKONLINE.CO.UK>
> Aan: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
> Onderwerp: Re: Ascii constants
> Datum: donderdag 10 februari 2000 0:54

Hello Andy, Walter,

 I could not make out wat type of controller is used, but when using MPLAB
with a 16x84, 16c74, 16c54 or 17c44 (the chip's I used text-strings in) the
syntax seems to be :

  SomeLabel    DT  "some text",Some8-bitConstant

for data embedded in the Code-memory.  The data will be converted to RETLW
instructions, easy to use in a Table.

Regards,
 Rudy Wieser


{Quote hidden}

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