Searching \ for '[PIC]: Undefined symbols?' 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/devices.htm?key=pic
Search entire site for: 'Undefined symbols?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Undefined symbols?'
2003\03\04@171928 by Glen Holmes

flavicon
face
I am trying to write an ISR that will save and restore certain registers (w, STATUS, etc).  I found several good examples in the PICList source code library; but I am doing something wrong when I try to implement them.

When I write:

movwf  temp_w
swapf  STATUS, w
clrf   STATUS
movwf  temp_STATUS
movf   PCLATH, w movwf  temp_PCLATH
clrf   PCLATH
movf   FSR, w
movwf  temp_FSR

the assembler complains about undefined symbols.  Well, that seems fair, after all I didn't define the temporary "holders" that I am using.

So I added:

#define    temp_w
#define    temp_STATUS
#define    temp_PCLATH
#define    temp_FSR

But the assembler didn't like that either, and complained about missing arguments.  Sheesh!!  Picky, picky, picky!

So I guess my question is, "What is the correct way to let the assembler know that I want to store something temporarily in memory?"

Thanks in advance,
Glen

--
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

2003\03\04@173217 by Tony Nixon

flavicon
picon face
Glen Holmes wrote:
{Quote hidden}

You need RAM to store variables, so define them in RAM :-)

temp_w          equ 0x7C
temp_STATUS     equ 0x7D
temp_PCLATH     equ 0x7E
temp_FSR        equ 0x7F

or

       CBLOCK 0x7C
temp_w
temp_STATUS
temp_PCLATH
temp_FSR
       ENDC

These are in RAM page 0, which is where your interrupt routine is trying
to send the values to save, except for temp_w.

The reason for the upper RAM page is that the last 15 registers are
available from all RAM pages. When you are storing the W value at the
start of the ISR, the RP0/RP1 bits in STATUS could be pointing to any
RAM page, and therefore W could be saved into any of the available RAM
pages. This method saves you having a temp_w register that must be
available at the same offset in every RAM page.

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
spam_OUTsalesTakeThisOuTspambubblesoftonline.com

--
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

2003\03\04@174250 by Olin Lathrop

face picon face
> I am trying to write an ISR that will save and restore certain
> registers (w, STATUS, etc).  I found several good examples in the
> PICList source code library; but I am doing something wrong when I try
> to implement them.

See QQQ_INTR.ASPIC at http://www.embedinc.com/pic.

{Quote hidden}

That's probably because you put the opcodes in column 1, which is reserved
for labels.

> #define    temp_w
> #define    temp_STATUS
> #define    temp_PCLATH
> #define    temp_FSR
>
> But the assembler didn't like that either, and complained about missing
> arguments.

Um, that's because they are missing.

> So I guess my question is, "What is the correct way to let the
> assembler know that I want to store something temporarily in memory?"

The RES directive.  See lots of examples at http://www.embedinc.com/pic,
after you've gone back and read the assembler manual again (for the first
time?).


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
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

2003\03\04@174253 by Ian McLean

flavicon
face
Glen,

Your temporary variables should be declared as file registers.  For
simplicity, wrap them up in a CBLOCK at the start of your code before you
Org.

e.g.

CBLOCK 0x20
       temp_w
       temp_STATUS
       temp_PCLATH
       temp_FSR
ENDC

This defines a block of 4 x 1 byte file registers starting at 0x20 in RAM.

This is necessary because the movwf intstruction moves W to a FILE register.
"Temporarily store in memory" does not make much sense on a PIC.
"Temporarily store" usually means holding in W, the working register ... You
have W and file registers, that is it.
Besides, if you are storing these registers as part of an ISR context saving
procedure, they want to be static in any event.

Rgs
Ian

{Original Message removed}

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