file "filename"
Basil
Posts: 380
Hi All,
I seem to be bombarding this board with questions recently...
Anywho, In my application I used to have a bunch of previously recorded samples stored in the data section in the following format
byte 202,201,202,202,202,202,202,202 etc etc
When compiled, the program had 2972 longs free.
When I take all that data out ond put it into a txt file, then use the 'file' instruction in the dat section, I only get 618longs free when complied.
Am I formating my txt file incorrectly? I have removed all the spaces, new lines and comma's so its just a huge line of numbers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
I seem to be bombarding this board with questions recently...
Anywho, In my application I used to have a bunch of previously recorded samples stored in the data section in the following format
byte 202,201,202,202,202,202,202,202 etc etc
When compiled, the program had 2972 longs free.
When I take all that data out ond put it into a txt file, then use the 'file' instruction in the dat section, I only get 618longs free when complied.
Am I formating my txt file incorrectly? I have removed all the spaces, new lines and comma's so its just a huge line of numbers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
Comments
The compiler converts "byte 202" into just one byte. In text that's three bytes "2", "0" and "2". You'll need to find a means to convert your text into a set of bytes, one byte per number.
What if I were to store it as binary? Or would that be a string of binary? Ie "1""0""0""1""1" etc?
How do I store it as hex or binary directly in a file?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
You can also write your own program that will read a sequence of numbers ranging from 0 to 255 and write each number out as a byte
to a file.
The easiest thing to do is to let the Propeller Tool do it and just use the BYTE statement the way you started out.
Is there I way I can do something like
In the main program object section...
OBJ
Data : "Data.spin"
and in Data.spin, only have:
DAT
byte 123,234,23,45,56,45 etc
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
You can use PropTool to generate a Binary from your text-datas! Write a spin source like this:
You can compile such an "object" with F8 and then save as binary. You get the data as a binary with a little overhead at begin.
Now you can include this binary with the FILE command in an other object. Your data start at the 24th byte in the produced binary, so you have to take that into account.
Andy
Yes, but you'll need a "PUB" at the top to get it to compile and you'll need a PUB anyway so you can return the address of where the data starts to your higher-up program ...
To access the data from the higher program ( untested ) ...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page