Code verify on 12F683


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2008
    Posts
    16

    Default Code verify on 12F683

    Hello all!

    I haven't had any luck searching on this topic. I have a RBPro 2.50A program running on a 12F683. Program runs fine. I want to add a short section of code at the top of the program which would do a code integrity check, to try and verify that the program code got loaded correctly, and check that nothing has changed. Could be a full CRC check or maybe a quick and dirty (cheap and cheerful) summation. The PB Pro instruction to do this should be the READCODE instruction. However this instruction does not work on the 12F683.

    Here's my program:

    '============================
    sum VAR WORD
    rslt VAR WORD
    i VAR WORD

    sum=0
    FOR i=0 to 2047
    READCODE i, rslt
    sum=sum+rslt
    NEXT I
    IF rslt != $3DF5 THEN STOP
    '============================

    At compile time this code produces:

    Error READCODE.ASM 51:[225] undefined symbol 'eeadrh'
    Error READCODE.ASM 51:[225] undefined symbol 'eedath'
    Error READCODE.ASM 51:[212] extra tokens on end of line

    I'm not concerned about the meaning of the error messages, just the fact that READCODE does not compile for the 12F683. The code shown here compiles fine on a 16F877.

    So, my Question:
    Does anyone have any ideas on how to read program memory in the 12F683 (or any other 12F part)?

    Thanks in advance for any suggestions!

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    12f683 has no
    • EEDATH
    • EEADRH
    registers and cannot read the flash pgm memory , along with many other chips


    from the manual


    READCODE


    Read the value at location Address in code space into Var. Some PIC16F and
    PIC18 devices allow program code to be read at run-time. This may be useful for
    additional data storage or to verify the validity of the program code. For PIC16F
    devices, 14-bit-sized data can be read from word code space Addresses

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    Some programmers like for example my U2 USB Programmer have a verification routine after writing the program in the chip. You might want to use that feature that has already been created for you. Easier for you and no headaches .
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4
    Join Date
    Mar 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    Quote Originally Posted by rsocor01 View Post
    Some programmers like for example my U2 USB Programmer have a verification routine after writing the program in the chip...
    Thanks. This would be fine for one or a few instances. In my case a PCB assembler will be gang-programming many chips. Plus, once out in the field I would like the program to not run at all if, whenever it powers up, the code validation fails. Any suggestions for a similar 8-pin chip which does allow to read out of program memory? Or some other way to do code validation?

    Thanks!

  5. #5
    Join Date
    Mar 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    Actually, a partial answer to my own question. Turns out that some of the 12(L)F1xxx family parts are available in 8-pin packages and have self-programming capability. However, for use with meLabs PIC Basic you need the PBP3 compiler. However, I'm still searching for a way to do code validation on the 12F683.
    Any more ideas?? Thanks!

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    Quote Originally Posted by swr999 View Post
    Thanks. This would be fine for one or a few instances. In my case a PCB assembler will be gang-programming many chips. Plus, once out in the field I would like the program to not run at all if, whenever it powers up, the code validation fails. Any suggestions for a similar 8-pin chip which does allow to read out of program memory? Or some other way to do code validation?

    Thanks!
    If you are programming the chips at the factory in Thailand, they use CRC error checking. If you are using somebody else, do you mind me asking how are they "gang-programming" the chips? There have been a few people asking in this forum how to "gang-program" many chips, but I don't think that they never got a satisfying answer.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7
    Join Date
    Mar 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Code verify on 12F683

    Quote Originally Posted by rsocor01 View Post
    ... do you mind me asking how are they "gang-programming" the chips? ...
    Robert
    I may be using the wrong terminology. All I meant was that I send the hex code along with the gerbers and BOM and the assembly house includes loading the chips with my hex code as part of the assembly cost. But I don't know how they do it. But in addition to error-checking the initial loading of the hex code, I also want to re-validate the program memory space on each power-up and have the code not run if the code is not validated. I believe I can do this if I switch to a part like the 12F1xxx family.

Similar Threads

  1. 12F683 - basic code not working
    By Scampy in forum mel PIC BASIC Pro
    Replies: 56
    Last Post: - 12th February 2014, 00:29
  2. please help with 12f683 pwm code
    By haidar in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 22nd May 2013, 21:25
  3. pls help me verify my code not work, why???
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2010, 09:19
  4. 16F883 Code Verify Problem
    By munromh in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 11:47
  5. Code Protection with Verify Blues
    By Squibcakes in forum General
    Replies: 2
    Last Post: - 6th February 2006, 12:23

Members who have read this thread : 1

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