Today 00:49
Forum: Master Synchronous Serial Port (MSSP) module / 3-wire SPI / I2C / Master and Slave modes
Starter: RGV250
Views: 0
Replies: 0
Go to last post By: RayEllam
Today 00:32
Forum: Proton 24
Starter: RayEllam
Views: 1150
Replies: 8
Yesterday 15:42
Forum: Proton 24
Starter: matty
Views: 0
Replies: 3
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: I need help setting up the 18F13K22153 days old

  1. #1
    Junior Member Ledroj's Avatar
    Join Date
    Apr 2008
    Posts
    17
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    231.88 MB

    0 Not allowed!

    Default I need help setting up the 18F13K22

    Hello, I have included the following code to activate the PLL with clock at 16 Mhz internal, but I can not make it work at 64Mhz
    OSCCON = %11110110
    OSCCON2 = %00000101
    Config_Start
    FOSC = IRC ' Internal RC oscillator
    PLLEN = On 'On ' Oscillator multiplied by 4
    PCLKEN = On ' Primary clock enabled
    FCMEN = On ' Fail-Safe Clock Monitor enabled
    IESO = On
    PWRTEN = On ' PWRT enabled
    BOREN = OFF ' Brown-out Reset disabled in hardware and software
    WDTEN = OFF ' WDT is controlled by SWDTEN bit of the WDTCON register
    HFOFST = On ' HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
    MCLRE = OFF ' RA3 input pin enabled; MCLR disabled
    LVP = OFF ' Single-Supply ICSP disabled
    Config_End

    Somebody could help me ? Thanks.

  2. #2
    Senior Member charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    941
    Thumbs Up
    Received: 28
    Given: 26
    Total Downloaded
    1,003.23 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Try setting bit 7 of OSCCON2

  3. #3
    Member GAMBOA's Avatar
    Join Date
    Nov 2004
    Posts
    311
    Thumbs Up
    Received: 6
    Given: 0
    Total Downloaded
    79.87 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Hi,

    @Charlie, OSCCON2.7 is not defined.

    Regards,
    Gamboa

  4. #4
    Senior Member charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    941
    Thumbs Up
    Received: 28
    Given: 26
    Total Downloaded
    1,003.23 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Sorry, I assumed OSCCON2 would be the same as 18F26K22 but of course it isn't. Thanks for pointing that out G.

  5. #5
    Junior Member Ledroj's Avatar
    Join Date
    Apr 2008
    Posts
    17
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    231.88 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Hi, my program init:
    Device = 18F13K22
    Xtal = 64
    All_Digital = TRUE
    EData 225
    Include "CONTAD_7_Lib.pbp"
    OSCCON = %11110110
    OSCCON2 = %00000101
    I have defined OSCCON2 as OSCCON2 = 00000101
    Bit 7, this = 0, the datasheet pag 18 says.
    OSCCON2 bit 7-3 Unimplemented: Read as 0
    For testing I've put it to OSCCON2.7 = 1
    I still can not get it.
    Thank you for your help.

  6. #6
    Senior Member charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    941
    Thumbs Up
    Received: 28
    Given: 26
    Total Downloaded
    1,003.23 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Sorry Ledroj, I use the 18F26K22 a lot and I assumed OSCCON2 was the same, but it isn't. My mistake.
    Can you post more of your code please?

    Charlie

  7. #7
    Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    356
    Thumbs Up
    Received: 17
    Given: 2
    Total Downloaded
    871.52 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    If you look at Figure 2.1 (Clock Source Block Diagram) you will see that by selecting the internal oscillator (OSCCON <1:0> = 1x) source to the System Clock multiplexer the system clock will come from the output of the internal oscillators multiplexer as determined by the value of bit IRFC <2:0> (Max 16MHz). Whereas the output from the PLL forms the Primary clock input to the system clock multiplexer thus to use the PLL output as the system clock source select the primary clock source for the system clock (OSCCON <1:0> = 0x).

    Therefore if I was setting this device up to use the internal oscillator with PLL the changes I would make form your initial setup are...
    PCLKEN = On to PCLKEN = Off (you are not using it)
    OSCCON register to 11110100 to select the Primary Clock Source as the system clock.

    However I may be wrong as it is not entirely clear.
    The diagram and description appears to show that the PLL can be driven from either the 8 or 16MHz however I was unable to determine how you select which one. I would also set the OSCTUNE register to 11000000 just to be safe in ensuring PLL is on.

    You have not shown your setting for XINST but make sure it is off as it causes problems with Proton.

  8. #8
    Junior Member Ledroj's Avatar
    Join Date
    Apr 2008
    Posts
    17
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    231.88 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Hi Stephen, I have followed your instructions, but I have not achieved the desired result.
    I'm a little frustrated by the complexity of such a simple pic to bring it to 64Mhz, I do not understand so much compelling to configure.
    Not even 18f4550 had given me so much trouble.
    Thank you very much for your help.

  9. #9
    Senior Member charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    941
    Thumbs Up
    Received: 28
    Given: 26
    Total Downloaded
    1,003.23 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    The trouble could be due to MCLR being used as a signal pin. I tried to do that once and had similar trouble.

    Charlie

  10. #10
    Junior Member Ledroj's Avatar
    Join Date
    Apr 2008
    Posts
    17
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    231.88 MB

    0 Not allowed!

    Default Re: I need help setting up the 18F13K22

    Hello, the MCLR is only connected to VPP, by ICSP, although the MCLR is disabled in the configuration:
    MCLRE = OFF ',
    I can do a pull-upp to + vdd.
    I'll try it tomorrow.
    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Setting up A/D 18F45K80
    By chuckieboy in forum The Lounge
    Replies: 24
    Last Post: 1st September 2012, 00:56
  2. 18F13K22 and PIKIT2 round 2 - new info
    By barak in forum Proton Plus Compiler v3
    Replies: 38
    Last Post: 2nd August 2010, 22:43
  3. Xtal setting
    By nigelb in forum Proton Plus Compiler v3
    Replies: 20
    Last Post: 19th January 2010, 15:54

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