You could use something like
- Code: Select all
sub ReadItem(byref pStr as string)
dim StrPtr as POSTINC0
FSR0 = addressof(pStr)
do
StrPtr = ReadByte(Address)
loop until cchar(EEDATA) = nothing
end sub
sub WriteItem(pValue as string)
dim StrPtr as POSTINC0
FSR0 = addressof(pValue)
do
WriteByte(Address,StrPtr)
loop until cchar(EEDATA) = nothing
end sub
However, when using Firewing it's a good idea to get used to using "generic" pointer references. For example, you could write the code like this:
- Code: Select all
Sub ReadItem(ByRef text As String)
addr0 = AddressOf(text)
Do
*(addr0+) = ReadByte(Address)
Loop Until CChar(EEDATA) = Nothing
End Sub
Sub WriteItem(text As String)
addr0 = AddressOf(text)
Do
WriteByte(Address,*(addr0+))
Loop Until CChar(EEDATA) = Nothing
End Sub
Note the use of "addr0". This is a portable pointer reference which will work with PIC18, PIC24 and PIC32 targets. All of the Firewing libraries use this technique so they can be built using 8, 16 or 32 bit compilers. For example, if you look at the "strings" module (click on the library in the explorer window) you will see something like this:
- Code: Select all
Public Function Len(ByVal value As String) As Byte
addr0 = AddressOf(value)
Len = 0
While *(addr0+) <> 0
Len += 1
End While
End Function
which determines the length of a given string. If the above function had used "FSR0" and "POSTINC0" it could only ever be built for PIC18 devices. There is more of a discussion here:
http://www.firewing.info/forum/viewtopic.php?f=7&t=39&p=190