Propeller Memory Card
SEL
Posts: 80
I do not have the knowledge to modify the supplied object so that I may write and read LONG data.
I need to store and retrieve larger data type other byte.
Anyone who can help I really would appreciate it very much
Thank you,
Stan
I need to store and retrieve larger data type other byte.
Anyone who can help I really would appreciate it very much
Thank you,
Stan
Comments
When I contacted Tech Support and asked if they had a solution, they had none. They did not tell me about the chip byte orientation.
This helps me to understand, a little, why i failed so badly.
Would it be possible to get a code snippet on how you might approach this problem of writing and reading longs?
No matter what I thank you very much!
Stan
Memory.readSRAM(memaddr, @yourlong, 4)
Memory.writeSRAM(memaddr, @yourlong, 4)
A long is just 4 bytes, so all you have to do is read or write 4 consecutive bytes and give the read or write function where in the SRAM your variable is (memaddr), a pointer to where your long is in HUBRAM (@yourlong), and 4 as the number of bytes to read.
Also see the Propeller Manual and read about, byte, word, and long aligned/sized data,
I will work on this and then report back.
Warmest regards,
Stan
The snippet of code below is just for test and proving. It Works!
I now will great an object to wrap the functions I will develop from this small start.
MP := 0
Index := 0
Data := 1000
Buffer.long[Index] := Data
Memory.WriteFlash(MP, @Buffer, 4)
MP := 4
Index := 1
Data := 2000
Buffer.long[Index] := Data
Memory.WriteFlash(MP, @Buffer, 4)
Memory.ReadFlash(MP, @Buffer, -1)
TransmitBuffer
Data := Buffer.long[0]
Term.str(string(CR))
Term.str(string("Data = "))
Term.dec(Data)
Term.str(string(CR))
Data := Buffer.long[1]
Term.str(string(CR))
Term.str(string("Data = "))
Term.dec(Data)
Term.str(string(CR))
repeat
PRI TransmitBuffer | Idx
repeat Idx from 0 to 63
ifnot Idx // 16
Term.Char(CR)
Term.Hex(Buffer.long[Idx], 4)
Term.Char(" ")
Term.Char(CR)