Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Program Erase on 18F468x

Dan Damron
2011-08-03
2013-05-30
  • Dan Damron
    Dan Damron
    2011-08-03

    I have developed a Reflow Oven Controller using a PIC 18F4685.  I used GCBasic as I have used it in the past, and it's a quick way to prototype.  My program works great, however after a few real world tests, I have decided to make the Heating and cooling stages PROACTIVE instead of REACTIVE.

    Now, here's the situation:
    I need to collect some sample data for analysis.  The EEPROM is currently being used to store configuration settings, and isn't big enough to hold a full set of sample data.

    My program only uses 0x2400 bytes, which leaves a TON of Program space available, not being used.  I figured I could leave a chunk of space for the code (just in case), and start logging the data in the program space.  I just need to do this a few times so I can get some base data.

    When I execute ProgramErase(in ProgramLocation), regardless of ProgramLocation, it erases the first 32 words (64 bytes).
    I also dug into the datasheet, and started examining EPROM.H (ProgramRead, ProgramWrite, and ProgramErase are).

    The 18F486x must use a new method for these routines, as they are not quite the same as what the header file shows.

    To Read data from program space, there is a new instruction,  TBLRD..

    Also, the EEAddress (programLocation) seems  to set the address in EEADR via an alias.
    The datasheet says the location is stored in TABLATU, TABLATH, and TABLATL..

    This leads me to assume the 'new' microchip routines for these chips haven't been updated..

    Any Ideas?

    Even if I can get that new instruction TBLRD added to the compiler, right now it thinks it's a syntax error.

    Thanks ahead of time!

    Dan

     
  • Are you using the correct syntax of TBLRD*. The star at the end is part of the mnemonic. It compiles okay for me using MPASM or the internal assembler.

     
  • Dan Damron
    Dan Damron
    2011-08-05

    I have tried to embed that opcode, but i keep getting syntax error…
    Ive tried
    TBLRD*+
    , asm TBLRD*+, and asm: TBLRD*+…

    Can you show me the correct syntax? 
    Thanks huge!

    Dan