Searching \ for '[PIC] Loading the FSR on an 18F' 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=18F
Search entire site for: 'Loading the FSR on an 18F'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Loading the FSR on an 18F'
2006\09\24@214815 by Josh Koffman

face picon face
Hi all. I'm working on a project for the 18f2520. This is the first
time I'll be using the FSR on an 18f chip and I need a reality check.
Near as I can tell the only way to load a value in the FSR is using
the LFSR instruction. However, that only allows a constant as an
argument. What if I want to add two values together then put the
result in the FSR and use it as an offset.

Surely I must be missing something here...

Josh
--
A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
       -Douglas Adams

2006\09\24@221122 by Jinx

face picon face

> Near as I can tell the only way to load a value in the FSR is using
> the LFSR instruction

Hi Josh, you can use instructions on the fsr registers, eg a couple
of examples from working code

        clrf    fsr0h
        movlw   db_addr1        ;address array
        movwf   fsr0l

        lfsr    fsr0,command+0x03 ;source
        movfw   phone_os
        addwf   fsr0l

2006\09\25@083154 by Josh Koffman

face picon face
On 9/24/06, Jinx <spam_OUTjoecolquittTakeThisOuTspamclear.net.nz> wrote:
> Hi Josh, you can use instructions on the fsr registers, eg a couple
> of examples from working code
>
>          clrf    fsr0h
>          movlw   db_addr1        ;address array
>          movwf   fsr0l
>
>          lfsr    fsr0,command+0x03 ;source
>          movfw   phone_os
>          addwf   fsr0l

That's what I thought...but when I tried it FSR0 doesn't change in my
watch window. I wonder if it could be because I'm single stepping with
an ICD2?

Josh
--
A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
       -Douglas Adams

2006\09\25@104005 by John Chung

picon face
was the bank and page selected correctly for the fsr?

John

--- Josh Koffman <.....joshybearKILLspamspam@spam@gmail.com> wrote:

{Quote hidden}

> --

2006\09\25@143931 by Thomas C. Sefranek

face picon face
Ahhh John,

18F don't need bank and page selection for FSRs.

 *
 |  __O    Thomas C. Sefranek  .....WA1RHPKILLspamspam.....ARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

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

{Original Message removed}

2006\09\25@232922 by Josh Koffman

face picon face
Ah what a difference fresh eyes make...

After looking at my code again today I noticed I had left out an 'L'.
A rather important one...it belonged at the end of FSR0. Surprisingly
enough, nothing complained that I was trying to write to FSR0 and not
FSR0L. I guess it must be mapped somewhere, though I haven't looked to
see where.

Thanks everyone.

Josh
--
A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
       -Douglas Adams

2006\09\25@234349 by John Chung

picon face
Ah...... Need to upgrade my *memory* on the PIC18

John

--- "Thomas C. Sefranek" <EraseMEtcsspam_OUTspamTakeThisOuTcmcorp.com> wrote:

{Quote hidden}

> {Original Message removed}

2006\09\26@000433 by Jinx

face picon face
> Ah what a difference fresh eyes make...
>
> After looking at my code again today I noticed I had left
> out an 'L'
> nothing complained that I was trying to write to FSR0

MPLAB has caught me like that. Something incorrect will
not produce an error, but it won't be included in the code
either. I can't think of a specific example but say you have

100 movlw 0x58
101 (an instruction not recognised but not build-fatal)
102 rrf temp

when you look at the Program Memory you'll see just

100 movlw 0x58
101 rrf temp

Put the code how it was and see what's in PM after the build

2006\09\26@060111 by Howard Winter

face
flavicon
picon face
Jinx,

On Tue, 26 Sep 2006 16:04:33 +1200, Jinx wrote:

>
> MPLAB has caught me like that. Something incorrect will
> not produce an error, but it won't be included in the code
> either.

This is a bug in MPASM, surely?  One of the Rules of Compilers is "Never leave an error unreported" and just ignoring something it doesn't recognise is
terribly dangerous.

Have you reported it to MChip?

Cheers,


Howard Winter
St.Albans, England


2006\09\26@064516 by Jinx

face picon face
> > MPLAB has caught me like that. Something incorrect will
> > not produce an error, but it won't be included in the code
> > either.

> Have you reported it to MChip?

Next time I see it I will. Unfortunately I really can't think of
examples to cite now, but it does happen occassionally,
almost always a typo. I could fumble some code, but if it's
been reported already, the version I use now (7.30) might
be OK


2006\09\26@071259 by WH Tan

picon face
2006/9/26, Josh Koffman wrote:

> ...nothing complained that I was trying to write to FSR0 and not
> FSR0L. I guess it must be mapped somewhere, though I haven't looked to
> see where.

Surely nothing will happen.  If you check again the define for FSR0,
you'll understand why you never got a warning or error.

A side note: I bet everytime someone posted a code like this:

movf a_register, 1, 0

Many will say don't use that code. Use the symbol defined in
header/include file.

But I will have no complaint at all if I see this:

lfsr 0, a_register   ; Note the use of 0 instead of FSR0.

--
WH Tan

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