Storing data in Flash (Program) memory


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default

    Thank you Darrel for your help.
    I am going to try this

    Mike BZH

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Yikes! I just realized you wanted 64k of data.

    Do you have PBP 2.50?
    With PBPL the READCODE statements can work above 64k, as long as the address variable is a LONG.

    PBPW, can only READCODE up to the 64k barrier.

    It's also possible to access the memory above 64k without using readcode if you don't have PBP 2.50, but it's a little trickier.
    <br>
    DT

  3. #3
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default

    Yes, I have PBP 2.50b.
    So, it should work....

    Michel

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MikeBZH View Post
    Yes, I have PBP 2.50b.
    So, it should work....
    Yes it will. (using PBPL)

    With the EXT example I pointed to earlier, all you need to change is ...
    Code:
    Offset    VAR  LONG
    Even though Offset will never be greater than 65535, one of the parameters of the READCODE statement has to be a LONG.
    Since DataTable is a constant, the Offset variable gets the duty.

    I'm curious where the data is coming from.
    Obviously you won't want to create 64k worth of DW statements.

    Is the data in a file of some type?
    <br>
    DT

  5. #5
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default

    Dear Darrel,

    Thank you again for your help
    I will try all this as soon as I dig into the SW. I am currently testing and validating the hardware.
    The data will be bytes, but don't be afraid, I will not type then one by one !
    They will come from already existing tables in text format. So a simple select, copy and paste to the source file will do the job.

    Best regards

    MikeBZH

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MikeBZH View Post
    The data will be bytes, but don't be afraid, I will not type then one by one !
    They will come from already existing tables in text format. So a simple select, copy and paste to the source file will do the job.
    Great! That'll make things easy.

    Just one more suggestion then ...
    Put the data in a separate .ASM file.
    Code:
     ; make sure each line has an Even number of values.
      DB  0xA4,0x95,0xB5,0xAA,0xA5,0x49,0x55,0x56,0xAD,0x55,0x4A,0x56,0xB5,0xAA
      DB  0xAD,0x56,0xD6,0x48,0x49,0x5B,0x6A,0xB5,0x55,0x4A,0x4A,0xAD,0x6A,0xAA
      DB  0x94,0xAA,0xAA,0xB5,0x5A,0x54,0xAA,0xB5,0xAA,0xB5,0x55,0xAD,0x69,0x11
      DB  0x25,0xB6,0xB5,0x55,0x55,0x25,0x2A,0xDA,0xD5,0x4A,0x52,0xAA,0xAD,0x55
      ; ...
      DB  0x6A,0xA9,0x25,0x2A,0xD5,0x6A,0xAA,0x95,0x55,0xAD,0x55,0x55,0x55,0xAD
      DB  0x6D,0x44,0x12,0xAD,0xDA,0xAA,0xAA,0x52,0x55,0x5B,0x6A,0x94,0x94,0xAA
      DB  0xB5,0x5A,0xA9,0x52,0xAD,0x6B,0x55,0x55,0x55,0x5B,0x5B,0x50,0x82,0x5B
    PBP has a limit to the number of lines in an ASM block.
    That .ASM file can be included from the program by the assembler which doesn't have that limit.
    Code:
    DataByte   VAR  BYTE
    Offset     VAR  LONG
    DataTable1 CON  EXT
    DataTable2 CON  EXT
    
    '-----[The DATA table]--------------------------------------------------------
    GOTO OverData             ; Make sure data doesn't try to execute
    ASM
    DataTable1
        #include "MyData.ASM"
    EndTable1
    
    DataTable2
        #include "MyOtherData.ASM"
    EndTable2
    ENDASM
    OverData:
    
    '-----[Retrieve from DATA table]----------------------------------------------
    Offset = 1
    ReadCODE  (DataTable1 + Offset), DataByte
    
    LCDOUT  $FE, 1, HEX2 DataByte," "
    DT

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts