create a string with serial input data
William50
Posts: 22
I have a logging device sending serial data into the serial port. The first eight bytes of the data is a string header. After the header is sent I am storing the data that follows on a memory card.
I want to create a file on the memory card using the object "fsrw" and name the file using the string header. Is there a way to assemble the first eight ASCII header bytes into a string?
Cheers,
William
I want to create a file on the memory card using the object "fsrw" and name the file using the string header. Is there a way to assemble the first eight ASCII header bytes into a string?
Cheers,
William
Comments
Make the 9th byte a Zero, and use the address of the first byte as the string address pointer.
...or you could 'copy' the data bytes using bytemove into a scratch pad area and essentially do the same thing. make sure the last byte is zero, and point to the first byte as the string address.
So if I create a buffer for the filename string such as:
byte filename[8]
I point to the string by:
@filename
Do I have this correct?
Don't forget the extension ... FILENAME.EXT ... so the buffer should in the end be 13 bytes with the dot being fixed at position [ 8 ] - hope I remember this right ;o)