Menu

Compiler sets wrong frequency on PIC18F14K22

2015-03-19
2015-07-30
  • William Roth

    William Roth - 2015-03-19

    I posted on this previously but there was no response or acknowledgment from anyone.

    The problem still exists. The work around that I previously posted does not work when an LCD is used, because the frequency not being set before the LCD is initialized.

    This renders the PIC18FK22 useless above 16Mhz when using the internal oscillator. If either 32 or 64Mhz are set, the actual clock speed is 1 MHz, but GCB thinks it is operating at 32 or 64 MHz and nothing works.

    The problem is when the Chip MHz is set to either 32 or 64 MHz, system.h does nothing with either the OSCCON resister or with the PLLEN bit. INITSYS in the ASM file is void of any frequency settings whatsoever.

    I modified my own system.h with a chip specific work around so that the frequency is set correctly with the PIC18F14K22. However, I suspect that other chips may also be affected.

     

    Last edit: William Roth 2015-03-19
  • Anobium

    Anobium - 2015-03-19

    Have a look at build 272. Would this fix this issue? Build 272 was from Tuesday this week.

    http://sourceforge.net/p/gcbasic/code/272/

     
  • William Roth

    William Roth - 2015-03-19

    That does not fix and is what I am currently using.

     
  • Anobium

    Anobium - 2015-03-19

    OK.

    What changes are you making in system.h? This should save time in figuring out the way forward.

     
  • William Roth

    William Roth - 2015-03-19

    Hi Evan,

    It seems that even with all of the bit tests, the PIC18F14K22 get missed if ChipMhz is either 32 or 64.

    What I did was add a chip specific routine that tests for ChipNameStr and then set the appropriate bits for 64 and 32 Mhz.

    Attached is my system.h file with the workaround.

     
  • Rikki

    Rikki - 2015-07-30

    I too have gone in circles trying to sort this out....here are my most successful config settings.

    Works for 18F26K22 and 18F14K22.

    tried pasting code but the format is crazy. So please see attached file.

    enjoy !

     

    Last edit: Rikki 2015-07-30
  • Anobium

    Anobium - 2015-07-30

    This a known issue. It is hopefully fixed.

    What release/version of GCB are you using?

    Anobium

     

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.