I would like to transfer a byte as a string from an eeprom memory. I can transfer a byte in and out with no problem, but can not figure out how to read the byte as a string or convert it to a string.
Thanks!
SPI.Transfer a string
Moderators: David Barker, Jerry Messina
Re: SPI.Transfer a string
Figured it out. I was not declaring the the string variable with an extra byte for the null character.
and
I originally had my_id As String(4).
Code: Select all
Public Function READ_STRING(p_addr As LongWord) As String * 4
OPEN_SPI()
Low(mem_cs)
SPI.Transfer(read_data) ' Read instruction
SPI.Transfer(p_addr.byte2) ' Address byte 2
SPI.Transfer(p_addr.byte1) ' Address byte 1
SPI.Transfer(p_addr.byte0) ' Address byte 0
result(3) = SPI.Transfer()
result(2) = SPI.Transfer()
result(1) = SPI.Transfer()
result(0) = SPI.Transfer()
High(mem_cs)
SPI.Close
End Function
Code: Select all
Private Dim
my_id As String(5)