Menu

burning data to eeprom during cpu programming

Help
2013-09-01
2013-09-02
  • Bob Knipper

    Bob Knipper - 2013-09-01

    Greetings, I am writing a program for the 16f628. Is their a command in GCB that
    will create a hex file that ,during programming the cpu, will load data into eeprom.
    I want to have data in eeprom that I can during the program read and modify.
    Thanks Bob

     
  • Anonymous

    Anonymous - 2013-09-01

    I never figured out how to do this myself. So instead, I simply compile the code, then put the necessary .DE statements in the assembler code, and conclude by assembling.

    Thomas Henry

     
  • Anobium

    Anobium - 2013-09-01

    A great question. You can use 'EPWrite location, data' (see the help file) but this function is byte by byte.

    @Thomas Henry can you post an example of your approach?

    I would like to have a function as follows using GCB not ASM within the Public function. An EEPROM function that take a string or data sequence and write to the EEPROM. I we have EPWrite location, data but has someone written a food function?

    Anobium

    EEPROM 0,(“Hello World”): 'save values in EEPROM

    main:
    for loopvar = 0 to 10 ; start a loop
    read loopvar, indata ; read value from EEPROM
    hserprint in data ; transmit to serial LCD module
    next loopvar ; next character

     

    Last edit: Anobium 2013-09-01
  • Hugh Considine

    Hugh Considine - 2013-09-02

    There's no nice way to do this, but there is a trick with the Table statement that you can use. If the compiler is told to store a data table in "Data" memory, it will store it in the EEPROM. Here is some example code:

    #chip 16F628
    
    'Read table item
    'Must use ReadTable and a variable for the index, or the table won't
    'be downloaded.
    TableLoc = 2
    ReadTable TestDataSource, TableLoc, SomeVar
    
    'Write to table (example, can change)
    EPWrite 1, 45
    
    'Table of values to write to EEPROM
    'EEPROM location 0 will store length of table
    'Subsequent locations will each store a value
    Table TestDataSource Store Data
        12
        24
        36
        48
        60
        72
    End Table
    
     
  • Anobium

    Anobium - 2013-09-02

    Cool. OK. Very good.

    Can you clarify? Have I got the wrong end of the stick?
    1. When I tried your example. I got one byte written to the EEPROM not the table contents. I got value 0x2d at location 02. Does this mean the table is not written out? Is this dependent on a file I don't have?
    2. The variable 'somevar'. It is essentially a nul variable? Meaning it could be any variable?
    3. I just found the table values... at location 0x1800 (for the device 16f1825), so, the table is in program memory not EEPROM?
    4. But, in my simulator of a 16f628 it is located in EEPROM. So is this solution pic dependent? or, the addressing to the EEPROM for specific devices required?

     

    Last edit: Anobium 2013-09-02
  • Bob Knipper

    Bob Knipper - 2013-09-02

    Thanks all, for the help. I had been loading the hex file into my programmer program.
    'WIN PIC PROGRAMMER' and manually entering data. then re-saving the file.
    Kind of a convoluted but works. Bob
    Tried both ideas, worked great

     
  • Anonymous

    Anonymous - 2013-09-02

    Thanks for the tip, Hugh. The real hassle with what you propose is that each datum must appear on a separate line. It would be so cool if that could be overridden somehow, allowing the compiler to parse entire horizontal lines, and even permitting string literals. For example:

    TABLE TestDataSource Store Data
    "Here's a message."
    END TABLE
    

    Thomas Henry

     
  • Anobium

    Anobium - 2013-09-02

    HUGH can you check this statement: This only works currently with current EEPROM memory devices. This means you must verify your device to use this technical solution.

     

    Last edit: Anobium 2013-09-02

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.