Searching \ for 'MPLAB assembler- problems with hex numbers' 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 assembler- problems with hex numbers'.

Truncated match.
PICList Thread
'MPLAB assembler- problems with hex numbers'
1998\11\18@065621 by Nigel Orr

flavicon
face
I've hit on an odd problem with the equ's at the start of my code

I have various ones setting up register addresses etc, eg

data_in equ     21h
data_out        equ     22h

But when I try

ack_data        equ     FFh

I get an Error 113, undefined symbol.

Are the others not being translated as hex?  If so, are the data registers
actually at 21 decimal?  This should cause horrible crashes as I'm using
these registers already...

If I use

ack_data        equ     0xFF

it seems OK

What am I missing?

Nigel

1998\11\18@073230 by Sean Breheny

face picon face
Hi Nigel,

At 11:55 AM 11/18/98 +0000, you wrote:
>But when I try
>
>ack_data        equ     FFh
>
>I get an Error 113, undefined symbol.

Could it be the old problem of an assembler interpreting a hex number as a
symbol when it starts with a letter? Usually, if a hex number starts with a
letter, you put a leading zero on it, like:

ack_data    equ    0FFh

At least, that's the way it is done in Microsoft Macro Assembler.

>
>Are the others not being translated as hex?  If so, are the data registers
>actually at 21 decimal?  This should cause horrible crashes as I'm using
>these registers already...

No, these are probably working fine.



Sean

+-------------------------------+
| Sean Breheny                  |
| Amateur Radio Callsign: KA3YXM|
| Electrical Engineering Student|
+-------------------------------+
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
spam_OUTshb7TakeThisOuTspamcornell.edu  Phone(USA): (607) 253-0315 ICQ #: 3329174

1998\11\18@073635 by Quentin

flavicon
face
If I remember correctly MPLAB (MPASM actually) does not accept FFh as hex.
It should be 0xFF or H'0FF'
I think your default Radix is decimal so the 21h and 22h is then wrong.

Quentin

1998\11\18@074051 by Mike Sauve

flavicon
face
At 11:55 AM 11/18/98 +0000, Nigel Orr wrote...
>I've hit on an odd problem with the equ's at the start of my code
>
>I have various ones setting up register addresses etc, eg
>
>data_in equ     21h
>data_out        equ     22h
>
>But when I try
>
>ack_data        equ     FFh
>
>I get an Error 113, undefined symbol.

Radix Specifications
Type                                                    Syntax  Example
Decimal D'<digits>'                             D'100'
Hexadecimal     H'<hex_digits>'                 H'9f'
Octal           O'<octal_digits>'                       O'777'
Binary          B'<binary_digits>'                      B'00111001'
ASCII           '<character>'A'<character>'             'C'A'C'

Mike

1998\11\18@083331 by Ian Rozowsky

flavicon
face
Nigel Orr wrote:

{Quote hidden}

I've run into the same problem. You will find that 0FFh will work,
but FFh won't. It appears as if the assmbler looks for a leading 0.

Ian Rozowsky
Development Engineer
Centurion Systems
Box 506 Cramerview 2060 South Africa
Tel   : +27-11-708-2680
Fax   : +27-11-708-2630
e-mail: .....rozKILLspamspam@spam@centsys.co.za

1998\11\18@170619 by Dale Wescombe

flavicon
face
At a quick guess, in phillips you need to proceed a letter (like F) with a
zero. Maybe with Microchip you need to add the x to ensure the assembelr
knows the F is a number and not a letter.
Dale

1998\11\19@030109 by Caisson

flavicon
face
> Van: Nigel Orr <nigel.orrspamKILLspamNCL.AC.UK>
> Aan: .....PICLISTKILLspamspam.....MITVMA.MIT.EDU
> Onderwerp: MPLAB assembler- problems with hex numbers
> Datum: woensdag 18 november 1998 12:55

Hello Nigel,

{Quote hidden}

registers
> actually at 21 decimal?  This should cause horrible crashes as I'm using
> these registers already...

To check this use the {project}.LST -file. In it you can see what the
Assembler _thinks_ you've written :-)

> If I use
>
> ack_data        equ     0xFF
>
> it seems OK
>
> What am I missing?

I think that you are missing a Bug-free assembler <VBG> .  Or, to say it
otherwise You've found  "bug with seniority" ;-)

Greetings,
 Rudy Wieser

1998\11\19@044310 by Andy David

flavicon
face
> > I've hit on an odd problem with the equ's at the start of my code
> > I have various ones setting up register addresses etc, eg
> >
> > data_in equ     21h
> > data_out        equ     22h
> >
> > But when I try
> >
> > ack_data        equ     FFh
> >
> > I get an Error 113, undefined symbol.
> >
> > Are the others not being translated as hex?  If so, are the data
> registers
> > actually at 21 decimal?  This should cause horrible crashes as I'm
using
{Quote hidden}

       MPASM allows constants to be declared as hex values in
       the following ways:

               H'FF'
               0xFF
               0FFh

       My MPASM Quick Ref. Guide only mentions the first one, but
       I've found that the others also work.

       Parsing from left to right, MPASM expects to find either
       a base specifier, or a digit (0-9 inclusive). 21h and 22h
       would be declared as 21 and 22 hex respecively, but
       FFh is invalid as the left most character is neither
       a base specifier nor a digit - others on the list have
       confirmed that 0FFh works ok.

       Personally, I use 0xXX to declare hex values, B'XXXXXXXX'
       to declare binary values, and .xxx to declare decimal
       values - I've never felt the need to declare in Octal,
       but I'd probably use XXXo. This way the base of the
       declaration is clear not only to MPASM, but to me also.
       If I had a pound for everytime I've confused bases...


- Andy.

----------------------------------------------------------
Andrew David, Software Manager, Ultronics Ltd, Cheltenham.
EraseMEakdavidspam_OUTspamTakeThisOuTUltronics.co.uk          http://www.ultronics.com/
----------------------------------------------------------

1998\11\19@064256 by Nigel Orr

flavicon
face
At 14:34 18/11/98 +0200, you wrote:
>If I remember correctly MPLAB (MPASM actually) does not accept FFh as hex.

It seems to cope OK with 21 and 22- the absolute listing shows these have
been treated as hex.

>It should be 0xFF or H'0FF'

I know either of these are acceptable, just puzzled as to why 21 and 22
were OK, A0 or higher was not.  I guess the other responder was correct- I
tried 0AAh instead of AAh and it works fine.

>I think your default Radix is decimal so the 21h and 22h is then wrong.

Default is hex.

Thanks anyway,

Nigel
--
Nigel Orr                  Research Associate   O   ______
       Underwater Acoustics Group,              o / o    \_/(
Dept of Electrical and Electronic Engineering     (_   <   _ (
    University of Newcastle Upon Tyne             \______/ \(

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