Searching \ for '[PIC] : FSR & INDF ?' 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: ': FSR & INDF ?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] : FSR & INDF ?'
2002\04\04@111820 by Micro Eng

picon face
within an interupt, I am spitting out data serially on a I2C (this is based
on the AN734 app note).

I can get it to send out multiple bytes, recieve data, etc

For development purposes, I have a counter that just increments everytime it
drops into the routine so I can see the data come out as I expect it to.

However, I want to use the counter to point to a register location. In other
words, I have 10 registers and I want to sequence thru the locations
everytime I do a read.  Sounds simple, but looking for a pointer and sorta
assume that using the FSR might be the right approach?

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\04\04@115441 by Bob Barr

flavicon
face
On Thu, 4 Apr 2002 09:15:46 -0700, Micro Eng wrote:

>within an interupt, I am spitting out data serially on a I2C (this is based
>on the AN734 app note).
>
>I can get it to send out multiple bytes, recieve data, etc
>
>For development purposes, I have a counter that just increments everytime it
>drops into the routine so I can see the data come out as I expect it to.
>
>However, I want to use the counter to point to a register location. In other
>words, I have 10 registers and I want to sequence thru the locations
>everytime I do a read.  Sounds simple, but looking for a pointer and sorta
>assume that using the FSR might be the right approach?
>

Good assumption. That's exactly what the FSR and INDF will do for you.

Just be sure to preserve FSR on entry to your interrupt and restore it
on exit. And, no, please don't ask where this (not particularly
brilliant) piece of insight came from. :=)


Regards, Bob

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\04\04@120256 by Nick Veys

flavicon
face
> within an interupt, I am spitting out data serially on a I2C
> (this is based on the AN734 app note).
>
> I can get it to send out multiple bytes, recieve data, etc
>
> For development purposes, I have a counter that just
> increments everytime it drops into the routine so I can see
> the data come out as I expect it to.
>
> However, I want to use the counter to point to a register
> location. In other words, I have 10 registers and I want to
> sequence thru the locations everytime I do a read.  Sounds
> simple, but looking for a pointer and sorta assume that using
> the FSR might be the right approach?

You bet, INDF and FSR are used for indirect addressing (i.e. pointers)
in our beloved PICs...  Works great.

spam_OUTnickTakeThisOuTspamveys.com | http://www.veys.com/nick

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\04\04@120434 by Ted Mawson

flavicon
face
Micro Eng,

A point of detail.  You're putting a space between [PIC] and : so the
messages aren't getting onto the PIC discussion group needs to be [PIC]:

FSR is indeed the pointer, note you can set up a variable set say...

   CBLOCK    0x20
       Variable0
       Variable1
       Variable2
       Variable3
   ENDC

; obviously Variable0 starts at address h20 but you can have it elsewhere
although the following code relies on your variable array starting at  n0
(and you need to think about bits too - see below*).

   movlw    Variable0,    ; get the address of Variable0 into w
   movwf    FSR            ; put address from above into FSR
xyz:
   movf       INDF, w     ; get contents of Variable0 into w
;    ...  more code??
;    ...  more code??
   incf FSR, f                 ; increment the FSR pointer
   btfss FSR, 2              ; * test bit 2 to see if it's set (ie FSR has
inc'd to 4)
; alter the above line or do more complicated test on FSR bits or value.
You could start Variable0 at a location such that 10 inc's will result in 4
being set.
   goto xyz                    ; not done yet so do again
   next line of code

I can be hired if you want any code written!

Ted Mawson (unemployed)

{Original Message removed}

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