Reading a file
pbhuter
Posts: 36
I have seen some posts discussing reading an ASCII text file that seem to reference objects I can't find in the OE. I need to read an ASCII text file stored in memory and parse it to extract certain values from it. It will be in columns. I know how to do it in C, but I don't know how to make my Prop chip do it. Can I just write code in C and compile it in Catalina? Thanks.
Comments
Depends on which Propeller platform you have. If you have one with external RAM then yes - do it in C. Otherwise, probably not. The DOSFS file system that Catalina uses is too large to fit in Hub RAM (since using it also also requires the full extended stdio library. I think I could fit an "integer only" version of the extended library in Hub RAM, but I've not bothered since there would be so little space left for user programs it doesn't seem worthwhile).
I'm working on making Catalina able to execute code direct from external EEPROM (a feature that has been requested by several people) - but until that is ready, Catalina file system support is pretty much limited to Propellers with external RAM.
If it's something simple, I'd do it in SPIN. There are several good SPIN file system interfaces available. Just look in the OBEX.
Ross.
Paul
It doesn't really matter how big the file is, since it will be on an SD card. What Propeller platform do you have?
Catalina supports an SD card file system and external RAM (called XMM RAM in the documentation) on the Hybrid, DracBlade, RamBlade, Morpheus and TriBladeProp.
On other platforms you will have you write your own XMM access drivers.
You don't need to do anything special to use the XMM RAM - just compile your program with the -x2 or -x5 command line option.
Ross.
Right now I have the USB demo board that I am experimenting with. Eventually, I will (hopefully) be buying individual components and building my own board. I will likely use the same Prop chip (44-pin), although I'm not sure what name it has (Hybrid, DracBlade, RamBlade, Morpheus, TriBladeProp?) - I only see three Propeller chips in the store, one 40-pin and two 44-pin. How do I know which one I have, or obtain one of the ones you mention? Thanks for your help.
Paul
All the boards I mentioned are made by other members of these forums - they are not sold by Parallax. Each one implements a slightly different version of XMM RAM, depending (basically) on how many pins each developer is willing to sacrifice to be used as address lines.
On the Parallax demo board you will be able to use Catalina, but not the -lcx library (which is the extended version that includes full file system support).
If you choose to build your own board with XMM, I would encourage you to look first at these boards - one of them may suit your needs already, and each one has full Catalina support.
Good luck!
Ross.
Thanks for the information. I'll look into the boards on the site, although I'm pretty sure what I need will need to be built by me (although the thought of building a board somewhat terrifies me) because I need the total board to be really small (it may actually be multiple boards stacked on top of each other). One of the boards may work for me, but I'll have to rebuild it to suit my needs. Thanks again.
Paul
Catalina or BDSC under CPM would both work. Catalina will be faster.
The propeller chip you have will be fine. As will the eprom, the power supply etc. A dracblade adds a 512k ram chip, 3 latches and one HC138 chip.
Then you just add the sd card for mass storage, a vga socket to talk to a display and a socket for a keyboard.
I'm a big fan of making stuff for yourself. All the dracblade schematics etc are open source, including the eagle files.
If you want small, I'd recommend Cluso's ramblade. He managed to get the whole thing into a matchbox, and that is a record that is not likely to be broken soon!
Could you maybe post some skeleton C code, maybe our C programmers can take a look and see if it will work (ie it doesn't have huge storage buffers >40k), and maybe also someone might point out a simple spin solution.
It may be you don't need any external ram. Kye's sd card driver routines, coupled with kye's string code, can do some pretty nifty text manipulation using external sd card as temp storage.
Paul