Shop OBEX P1 Docs P2 Docs Learn Events
sx internal memory vs fram for a 96 byte array — Parallax Forums

sx internal memory vs fram for a 96 byte array

nick bernardnick bernard Posts: 329
edited 2006-11-30 21:52 in General Discussion
hail.

i've come to an xroads in my project and i could use some advice.

my application requires a 96 byte array which are updated roughly 10 times a second.
i dont have much experience with the sx28's bank command but gunther's programming the sx has cleared a few questions.

so i'm left with 2 options:
use the sx's internal ram to store my 96 byte array
or use my fram fm24c64 to store my 96 byte array (High Endurance 1 Trillion Read/Writes )
http://www.ramtron.com/lib/literature/datasheets/FM24C64ds_r3.0.pdf

simple math tells me i can expect 6,307,200,000 writes over 20years. which is much less than 1 trillion.

should i trust my fram to hold up over the decades, or develop a complex bank alorithm to satisfy my array?

rox on
nickb

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]

Comments

  • BeanBean Posts: 8,129
    edited 2006-11-28 17:41
    Nick,
    Are you using assembly or SX/B ?
    SX28 or SX48 ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
    ·
  • nick bernardnick bernard Posts: 329
    edited 2006-11-28 18:38
    bean,
    sx/b & sx28

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • BeanBean Posts: 8,129
    edited 2006-11-28 19:28
    If you use a SX48 it would be a piece of cake, since you can declare a 96 byte array.
    With the SX28 you need to do some work. In SX/B you can use the first array to access the elements in the other arrays. The trick is that there are 16 byte gaps inbetween. So Array1(15) is the last element in Array1, and Array1(32) is the FIRST element in Array2. But Array1(16) through Array1(31) cannot be used at all.

    Here is some code that use subroutines to access a virtual large array on the SX28.

    DEVICE SX28,TURBO,OPTIONX,STACKX,OSCXT1
    FREQ 4_000_000
     
    Array1 VAR Byte (16)
    Array2 VAR Byte (16)
    Array3 VAR Byte (16)
    Array4 VAR Byte (16)
    Array5 VAR Byte (16)
    Array6 VAR Byte (16)
     
    pos VAR Byte
    temp VAR Byte
     
    SetElement SUB 2 ' Position, Value
    GetElement FUNC 1,1 ' Position (returns Value)
     
    PROGRAM START NOSTARTUP
     
    START:
      ' Set all elements
      FOR pos = 0 TO 95
        temp = pos * 2
        SetElement pos, temp
      NEXT  
      ' Read all elements
      FOR pos = 0 TO 95
        temp = GetElement pos
      NEXT  
    END
    
     
     
    SetElement:
      __PARAM3 = __PARAM1 AND $F0
      __PARAM3 = __PARAM3 << 1
      __PARAM4 = __PARAM1 AND $0F
      __PARAM3 = __PARAM3 OR __PARAM4
      Array1(__PARAM3) = __PARAM2
      RETURN
     
     
    GetElement:
      __PARAM3 = __PARAM1 AND $F0
      __PARAM3 = __PARAM3 << 1
      __PARAM4 = __PARAM1 AND $0F
      __PARAM3 = __PARAM3 OR __PARAM4
      RETURN Array1(__PARAM3)
    
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin


    Post Edited (Bean (Hitt Consulting)) : 11/28/2006 7:33:01 PM GMT
  • jb1311jb1311 Posts: 20
    edited 2006-11-28 19:29
    In the November 2006 Nuts and Volts, Jon Williams had some code in his "Hacking the Parallax GPS Module" for a 64 byte array. It looks like it could be modified pretty easily.
  • nick bernardnick bernard Posts: 329
    edited 2006-11-30 21:52
    thanks for the help guys

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
Sign In or Register to comment.