Datalogging: Decoding hex on PC for viewing
T Chap
Posts: 4,223
I am logging some data from a sensor onto a USB drive, 6 bytes are read from the sensor, so I set it to write 8 bytes with two null bytes after the 6 data bytes so I could keep it all organized and easy to see the divisions as there may be thousands of sets of 8 byte reads. When I put the USB drive into the PC and open with the text editor, it is just some symbols, nothing I can make sense out of.
Sense the Prop is managing the write to the drive via the Vinculum, is there some easy method of reading back the data one row at a time and converting it to a readable format(ascii?). That way I can write a new decoded file back to the drive, drop it on the PC and see what is going on?
Ah, better yet, convert the data to a PC readable format prior to writing?
Sense the Prop is managing the write to the drive via the Vinculum, is there some easy method of reading back the data one row at a time and converting it to a readable format(ascii?). That way I can write a new decoded file back to the drive, drop it on the PC and see what is going on?
Ah, better yet, convert the data to a PC readable format prior to writing?
Comments
If you are not a 'vi' literate, be sure to download the graphical version ('gvim') - the option you need is then on the menu bar (Tools-> Convert to Hex').
You can get vim from http://www.vim.org/download.php#pc
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
For a byte 0-255 that would translate to three ascii bytes, 000 001 002 ... 255
For 1 value that happens to be just 0 to 9 in binary, you can convert to ascii 0-9 by adding 48 before you store it. So binary 0 becomes binary 48 which is ascii 0, binary 1 becomes binary 49 which is ascii 1 etc.
I've just finished writing a "bintoascii" routine in Z80 assembly that takes any two byte value 0-65535 and converts to 5 ascii values 00000 00001 ... 65535
You probably want one that takes 1 byte and converts to three ascii bytes. Or if you want to save space, to two hex bytes 00 01 02 .. FF
I'm not sure how to translate into spin though. There probably is a routine somewhere in the library.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
I am attaching a zip file with this message called
FileByteDisplay.Zip
In the file is the source code and the executable for a program
FileByteDisplay.EXE
The program will let you specify a file and it will display the bytes in the file
as either hex or decimal values.
Also if you wish to, it will also display the actual text characters
if they are displayable characters.
You can also save the generated output to a text file for later browsing.
The program was written compiled in RobotBASIC. If you wish you can
look through the source code to see how easy it is to do stuff like this
with RobotBASIC.
Sam