Regenerating OSCCAL


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    448

    Default Regenerating OSCCAL

    Here's something that might help some folks who have erased their OSCCAL values.

    I use a Pickit2, so I usually dont end up erasing the OSCCAL, and even if I do the Pickit2 generally regenerates it.

    But somehow, today, I had a chip that consistently said 'invalid OSCCAL', and sure enough it was erased. For some reason, Pickit2 failed to regenerate the value, although it was willing to let me specify it manually.

    So, just run the following code:
    FOR N = 1 to 255
    OSCCAL = N
    DEBUG #N,13,10
    PAUSE 200
    TOGGLE LED
    NEXT

    You'll get a string of incrementing numbers on your terminal, which are somewhat close to the value, as for these values the serial comms work.

    Just take the average of the first and the last, and there you are, your OCSCAL value.

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default Re: Regenerating OSCCAL

    Code:
    FOR N = 1 to 255 STEP 254
      OSCCAL = N
      DEBUG #N,13,10
      PAUSE 200
      TOGGLE LED
    NEXT
    Can we do this?

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