PIC24 and FSR2 / POSTINC2

General questions about Firewing...

PIC24 and FSR2 / POSTINC2

Postby Coccoliso » Thu Nov 27, 2014 11:27 am

Hello,
anyone know how to give a straight replacement of SFR2 / POSTINC2 in FW and PIC24?
From an application note talking about Wn ++
In FW is direct access to Wn?
Can anyone give me an example?
Many thanks to the "samaritan".

I tried to give me an answer but I'm dubious about the SAVE RESTORE mechanism.

The literal translation from SF:
Code: Select all
  Save(FSR2)
    FSR2 = pBufAddr
    While len > 0
        SPI.WriteByte(POSTINC2)
        Dec(LEN)
    End While
    Restore()


.. in FW is this ?

Code: Select all
    Addr0 = AddressOf(pBufAddr) 
    While len > 0
        SPI.WriteByte(*(Addr0+))
        len -= 1
    End While


.. and always in FW accordingly as above:

Code: Select all
    Addr0 = AddressOf(pDest)
    While len<>0
        len -= 1
        *(Addr0+) = CByte(value)
    End While
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: PIC24 and FSR2 / POSTINC2

Postby David John Barker » Thu Nov 27, 2014 5:05 pm

There is a little reference guide at the bottom of this thread:

http://www.firewing.info/forum/viewtopic.php?f=7&t=39&p=190

showing how to use Addr0, Addr1 and Addr2. Using these constructs ensures portability between PIC18, PIC24 and PIC32. The PIC24 and PIC32 devices do not have the equivalent POSTINC registers. You have to shell out to ASM if you want to manipulate an address register directly.
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

x