10F206 not running code


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2021
    Posts
    2

    Default 10F206 not running code

    Please allow me to get the setup info out of the way.
    PIC 10F206 genuine from Microchip directly.
    Picket 2 ( has the OSCCAL auto-regeneration )
    very simple flash test hex file
    PICBASIC PRO 3 compiler

    the code
    *************************************
    BLUE var GPIO.0
    WHT var GPIO.1


    Main:
    high WHT
    pause 100
    low WHT
    pause 100
    high WHT
    pause 100
    low WHT
    pause 250
    high BLUE
    pause 100
    low BLUE
    pause 100
    high BLUE
    pause 100
    low BLUE
    pause 250
    goto main

    *************************************

    When I compile and load the hex file nothing happens.
    Pickit2 VDD ON and MCLR off (unchecked)
    If I run the auto OSCCAL regeneration routine and then reload the hex file it runs.
    Turn off VDD and then back on, the program does not startup.
    If I MANUALLY enter the OSCCAL value, load the hex file, no run.
    Do the auto regen routine, load the hex, it works.
    I tried two similar hex programs, same results.
    There seems to be some state the PIC is left in after the auto OSCCAL routine which allows the program to
    start after loading the hex file. VDD MUST BE ON WHEN WRITING TO THE PIC. If you fail to have it on during the
    program writing, turning it on afterwards will not work. But once you perform that auto-regenerate routine, and the VDD is on,
    you can load either hex test file and it will run. You cannot turn VDD off and then back on, or it will stop running.
    Connecting the PIC to an external power source yields the same result as turning VDD off then back on, it doesn't run.

    The OSCCAL value does not change after running the auto-regenerate routine. Mine is 0C14
    The config is 0008.
    Wisdom please.
    Last edited by johnmatt1; - 27th September 2021 at 16:18. Reason: grammatical

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: 10F206 not running code

    Can't say I know what makes it run when you manually fiddle with the OSCCAL value but please repeat after me: I shall always check if analog functions are available on the pins I'm about to use. ;-)

    I opened the 10F206 datasheet and - sure enough - it's got a comparator which takes precedence over normal GPIO operation. You need to disable it in order for normal digital GPIO operations to work properly. Again, I can't explain how that would tie in with the OSCCAL thing but lets first see if the comparator is indeed the issue.

    /Henrik.

  3. #3
    Join Date
    Sep 2021
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: 10F206 not running code

    Henrik,
    You nailed it!
    CMCON0 = 0 ' turn off comparator
    Works like a champ. I can power off and on all day with no issues.
    Thank You
    John
    Last edited by johnmatt1; - 27th September 2021 at 21:07. Reason: format appearance

Similar Threads

  1. Replies: 27
    Last Post: - 9th April 2015, 05:51
  2. I'm running out of code space example.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st June 2010, 21:33
  3. Code running 19 times slower than intended
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th April 2010, 13:20
  4. 16f84a running interrupt PICBASIC code
    By divaker in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 31st July 2008, 16:49
  5. Running out of Code Space - or so it seems
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2006, 17:44

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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