Shop OBEX P1 Docs P2 Docs Learn Events
Reading a file — Parallax Forums

Reading a file

pbhuterpbhuter Posts: 36
edited 2010-08-10 08:03 in Propeller 1
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

  • RossHRossH Posts: 5,520
    edited 2010-08-10 03:50
    hi pbhuter

    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.
  • pbhuterpbhuter Posts: 36
    edited 2010-08-10 03:53
    Hey Ross, thanks. This ASCII text file could be pretty big (over 5000 lines with ten or so columns), so I think I'll have to put it in external memory. I'm assuming the Catalina documentation will tell me how to access external memory? And what do you mean by "external RAM" vs "external EEPROM"? Thanks again.

    Paul
  • RossHRossH Posts: 5,520
    edited 2010-08-10 04:05
    pbhuter

    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.
  • pbhuterpbhuter Posts: 36
    edited 2010-08-10 04:10
    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
  • RossHRossH Posts: 5,520
    edited 2010-08-10 04:36
    pbhuter,

    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.
  • pbhuterpbhuter Posts: 36
    edited 2010-08-10 04:39
    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
  • HughHugh Posts: 362
    edited 2010-08-10 05:51
    How about an SD card as a storage medium? Would the access speed be too slow (you would have to treat it as a serial-access device(?))
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-08-10 07:32
    I'm pretty sure that could work on a dracblade. I'm playing around with running four C programs at the same time, each reading and writing to the sd card asynchronously and at the same time, so parsing a text file ought to be fairly simple if you have an idea how to do it in C.

    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.
  • pbhuterpbhuter Posts: 36
    edited 2010-08-10 08:03
    I'm looking at the Ramblade, but it has more than I need. Cluso told me he has the schematics up on the post, and offered to help me out (I think) with designing my own board. The size of the Ramblade would actually be about what I'm looking for, but I don't need all the extra stuff. I'd like to NOT use an SD card, if possible.

    Paul
Sign In or Register to comment.