Is there somehow a way to return this byte array from either the function I created or via a module such the code could be called
Code: Select all
PageData = M25PReadPage(0)
Code: Select all
M25PReadPage(0)
PageData = M25PData
Code: Select all
Function M25PReadPage(pM25PDataAddress as byte) As Byte
M25PReadStatus() ' Check its not in the middle of a current write
While WIP = 1
M25PReReadStatus()
Wend
M25PDisable() ' Disable to ensure the read status is stopped
DelayUS(4)
M25PEnable() ' Enable the chip again
Shift.Out(MSB_FIRST,M25P_Read,8) ' Sent the data read instruction
Shift.Out(MSB_FIRST,pM25PDataAddress.BYTE2,8) ' Send the address
Shift.Out(MSB_FIRST,pM25PDataAddress.BYTE1,8)
Shift.Out(MSB_FIRST,pM25PDataAddress.BYTE0,8)
For M25PIndex = 0 To 255
M25PData(M25PIndex) = Shift.In(MSB_POST,8)
Next
M25PDisable()
End Function