Shop OBEX P1 Docs P2 Docs Learn Events
array size — Parallax Forums

array size

Andy WolffAndy Wolff Posts: 3
edited 2009-03-05 21:08 in Propeller 1
I am considering purchasing a prop development board for my iRobot Create.· I have been reading about the memory (cog ram, hub ram, eeprom, ect.) but I am still unsure about maximum variable size at runtime.· I need to create an environment map with my robot that is a 100 x 100 grid.· If each cell of the grid is a byte, then this array would take up 10kb.· Can I use an array at runtime that is this large?· The cog RAM is only 2kb.

I know that data can be stored in the EEPROM or hub RAM, but I am not sure if the cog RAM is always used when manipulating data.· The cog RAM would overflow quickly with a 2D grid of data.

·

Comments

  • Luis DigitalLuis Digital Posts: 371
    edited 2009-03-05 14:36
    I think that will not have problem of space for its application. Cog RAM is used mainly for ASM code.

    You have in total:
    Free Memory = COG RAM + HUB RAM - programa code.
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-05 14:55
    Luis Digital is right if you can get your code into the reminding 22k of hub ram you will be fine. you can also write data easily to a sd card if speed not a problem.

    cog ram is only used when writing in pasm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Andy WolffAndy Wolff Posts: 3
    edited 2009-03-05 18:01
    Thank you both for such prompt answers! Let me make sure I understand... Can I have a large array stored in EEPROM or SD card memory that does not take up Hub or Cog RAM? Even if I access and write elements of that array?
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2009-03-05 18:14
    Depending on your applications speed requirements, spin can be used, which interacts with hum ram only. Spin uses cog ram for its own internal calculations, etc, and dumps the results into hub ram. The only time cog ram becomes an issue is when you are writing asm and don't want to spend the time and effort to use hub ram.
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-05 18:22
    if speed is not an issue yes you can use eeprom (my modules have double needed so extra data can be stored). I use a micro sd card to store audio files. can play 16 bit stereo in real time in spin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-05 19:08
    Just to clarify ...

    Yes, you can store large amounts of data in EEPROM or on SD cards, but it's not the same as arrays in the HUB (shared) memory. There are routines available for reading and writing data from/to EEPROM and there are routines for reading and writing PC compatible files to an SD card, but it's like having files on a PC, you can't just declare an array as being on an EEPROM or SD card.

    I have several programs that store tables on an EEPROM. One table is a dictionary of variable length names and associated data. You just have to be careful about writing repeatedly to the same location(s) since EEPROM can wear out after 100,000 or so writes to the same location.
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-05 19:13
    my eeprom rated for 1000 000. 10k table can fit in hub ram it just means you have to keep your code to the remainder.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Andy WolffAndy Wolff Posts: 3
    edited 2009-03-05 19:27
    Mike,
    I think I understand now... even if I store an array in the EEPROM or external SD card, it will need to be loaded into HUB RAM before I can modify/read elements of the array. Is this correct?

    Thank you all for your responses. This is a great forum!
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-05 19:40
    you do not need to read the entire table in but you do need to read the section you want in. the audio files I am playing off sd are several meg in size

    you can get s lot of code in 22k so you may not need anything more.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2009-03-05 21:08
    I am not mike, but yes you will need to load hub ram first..

    One thing though, the prop is well capable of doing what you want, I believe. I wouldn't let the 2k cog thing scare you away from what you want to do. All you'd need an eeprom or sd card for is for nonvolatile storage.
Sign In or Register to comment.