Announcement

Collapse
No announcement yet.

uOLED-160-G1 programme exceeds memory

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • uOLED-160-G1 programme exceeds memory

    Hi there,

    I have a program that uses two arrays of 160. When I try to compile it says I have exceeded the memory.

    Can I complile my program onto the uSD card to give me more memory space? I'm struggling to see how to do this.

  • #2


    From the datasheet you can see that you only have 255 x 16 bit variables of RAM.

    What you do with your program wont change that.

    What do you need two arrays of 160 for?

    Can they be bytes / bits / packed?

    How quickly do you need to access them? Could parts of the array be put on uSD?
    Mark

    Comment


    • #3


      My arrays only contain integers of a maximum of 128 therefore I really only need 1 nibble per array index. Is there way of specifying a set of integers to be only a nibble or a byte rather than 16 bits?

      My original post asked about using the uSD card for more memory space but I really have no idea how to do any of this...

      I should mention my previous programming experiance is limited to beginners desktop programming in C/C++ (1 module in my 1st year of university which was over 10 years ago now) so a lot of this is over my head... you could say this is a baptism of fire.

      Comment


      • #4


        You'll only get 0-15 in a nibble. (a nibble is 4 bits)

        I think following code will work for you, but I haven't even tried compiling it, let alone testing it.

        var bytearray[80] ;

        function readbyte(var idx)
        var i ;
        i := idx / 2 ;
        if (idx & 1)
        return bytearray[i] & 0xFF;
        else
        return bytearray[i] >> 8 ;
        endif
        endfunc

        function writebyte(var idx, var newval)
        var i ;
        i := idx / 2 ;
        if (idx & 1)
        bytearray[i] := (bytearray[i] & 0xFF00) + newval;
        else
        bytearray[i] := (bytearray[i] & 0xFF) + newval
        Mark

        Comment


        • #5


          OK with a bit of help from our software programmer I understand what this code is doing and i've incorporated it into my original code.

          Thanks for the help.

          With regards to my other question, can someone point me in the direction of how I can use the SD card to give me more memory for my data? I don't need to use it for pictures but this seems to be the only topic I can find which relates to the SD card when I search the forums.

          Comment


          • #6


            You would use the media functions, see the manual.

            Presumably you would set a sector, write using media_WriteWord and then use media_Flush to ensure the sector is written.

            You could later read it back by setting the sector and using media_ReadWord
            Mark

            Comment

            Working...
            X