P1c18f26k20-internal clock set up fail -64mhz


Closed Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    Apr 2008
    Posts
    85

    Angry P1c18f26k20-internal clock set up fail -64mhz

    HI,
    I TRY to set up to run the osc internal @64Mhz, but fail.

    conf_1H: FOSC_INTIO67 (or FOSC_INTIO7) ;OTHER config's of 1H are off
    OSCCON = $70 (16MHZ selected)
    OSCTUNE = $40 (enable PLL)

    the output @portb.6 fail (no power)-and data out from other pins runs fast

    OSCTUNE =$40 {omitted)
    data out from portb runs well, but slow and low power @ output

    i also try to set OSCTUNE TO $CF, maximum frequency and PLL enable, but portb.6 still lost power
    so what wrong?
    any help i do appriciate
    tks in ad.

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


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    try osccon.1 =1
    failing that post your code and tell us what version of pbp you are using

  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    This could help.

    Name:  Capture.PNG
Views: 584
Size:  35.2 KB

    OSCCON 6:4 need setting for 16 MHZ which is $70, which is what you have.
    OSCTUNE 6 needs setting to connect internal oscillator to 4xPLL $40, which you have.

    Looking at the Internal Oscillator Block OSCCON 1:0 have an effect and from the datasheet.

    bit 1-0 SCS<1:0>: System Clock Select bits
    1x = Internal oscillator block
    01 = Secondary (Timer1) oscillator
    00 = Primary clock (determined by CONFIG1H[FOSC<3:0>]).

    which tells me, if I understand correctly, that OSCCON 1 needs setting. Which is what Richard said.

    Which now makes OSCCON $72.

    Last there is config1H for HSPLL and HFINTOSC/PLL

    _FOSC_HSPLL_1H EQU H'F6' ; HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
    _FOSC_INTIO67_1H EQU H'F8' ; Internal oscillator block, port function on RA6 and RA7
    _FOSC_INTIO7_1H EQU H'F9' ; Internal oscillator block, CLKOUT function on RA6, port function on RA7

    which I leave to you or others to explain, I use boot loader and never used configs.

  4. #4
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Angry Re: P1c18f26k20-internal clock set up fail -64mhz

    THANSKS alot for your help.

    yes, i try

    OSCCON = $72,
    OSCTUNE = $40
    the problem still persises.
    portb.6 lost power. but it runs faster
    -------------------------------------------------------------------------------
    here is the conf.
    __CONFIG _CONFIG1H, _FOSC_INTIO7_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H' __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
    OSCCON = $72,
    OSCTUNE = $40
    -----------------------------------------------------------------------------
    portb = 0
    latb = 0
    trisb = 0
    ----------------------------------------------------
    about the SCS it is automatic set to 00- becasue in the CONFI_1h --- FOSC_INRIO67- (IT IS determined by primary osc in the 1H line)
    here is the explaination in the data sheet
    ------------------------------------------============
    2.9.1 SYSTEM CLOCK SELECT
    (SCS<1:0>) BITS
    The System Clock Select (SCS<1:0>) bits of the
    OSCCON register select the system clock source that
    is used for the CPU and peripherals.
    • When SCS<1:0> = 00, the system clock source is
    determined by configuration of the FOSC<2:0>
    bits in the CONFIG1H Configuration register.
    • When SCS<1:0> = 10, the system clock source is
    chosen by the internal oscillator frequency
    selected by the INTSRC bit of the OSCTUNE
    register and the IRCF<2:0> bits of the OSCCON
    register.
    • When SCS<1:0> = 01, the system clock source is
    the 32.768 kHz secondary oscillator shared with
    Timer1.
    After a Reset, the SCS<1:0> bits of the OSCCON
    register are always cleared.
    -----------------------------------------------------------
    the version, of pbp. it is 2.6c
    i read the post of: http://www.microchip.com/forums/m730158.aspx-
    also mentioned the same issue- but the PLLCFG is not recognized in the PBP

    thanks for your concern,
    regards

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    try a __CONFIG _CONFIG4L, _DEBUG_OFF in your configs

    as henrik wrote yesterday in a similar post the config option's syntax can be found in the pic18f26k20.inc file in your relevant version mpasm directory

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    interestingly there is a PLLCFG = ON in the pbp3 device reference config options


    look like a _PLLCFG_ON_1H is what you need
    Last edited by richard; - 26th July 2014 at 11:01. Reason: more info

  7. #7
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    HELLO,
    thanks for your guide,
    YES i try & _DEBUG_OFF_4L

    OSCCON = $72 (OR $70)
    OSCTUNE = $40
    PROBLEM PERSIS (slow)
    i will see the inc directory of mpas
    is it effected by the hc595?
    i found that its max freq. is 25MHz
    however, i test the 595 runs well @40mhz

    thanks a gain for your contribution
    regards

  8. #8
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    Very interesting thanks.

    Yes one of the settings that worked in the above link is.

    __CONFIG _CONFIG1H, _FOSC_INTIO67_1H
    OSCCON = $70
    OSCTUNE = $40

    Is that not what you started with?

  9. #9
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    Y]hello,

    yes the above is work.
    ..
    osccon = $70 or (60)
    osctune = $40

    for single leds
    i move to drive 595 then there r problem- lost power or low speed @ out put

    now i try to clean the pbp to see waht happen'

    thenak for your help.
    regards

  10. #10
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    HI ALL,

    the pic run well @ 4mhz ,HSPLL; 8, 10mhz ... problem (HSPLL).

    the conf. remains unchanged

    __CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
    __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L

    where is the problem?
    thanks all for your help
    regards

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    minhle
    quite a lot here seems to be lost in the translation somehow

    the output @portb.6 fail (no power)-and data out from other pins runs fast
    what does this mean ?

    the conf. remains unchanged

    __CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
    __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    have you now changed to using an external xtal ?

    i move to drive 595 then there r problem- lost power or low speed @ out put
    what is a 595 ? do you mean a 74hc595 ?
    if so a "595" can clock in data @100mhz which will be at least 10x greater than a bit banged routine could achieve even at 64mhz clock


    can I suggest you just try to "blink a led" on say portb.6 and see if it blinks at the correct rate , if not then post your complete code for further evaluation
    Last edited by richard; - 29th July 2014 at 03:43. Reason: typo

  12. #12
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    Quote Originally Posted by MINHLE View Post
    the conf. remains unchanged

    __CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
    __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L

    where is the problem?
    thanks all for your help
    regards
    The conf. has changed from #4
    here is the conf.
    __CONFIG _CONFIG1H, _FOSC_INTIO7_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H' __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
    also you said

    yes the above is work.
    ..
    osccon = $70 or (60)
    osctune = $40

    for single leds
    i move to drive 595 then there r problem- lost power or low speed @ out put
    If it works for single leds then it works and all of your code needs checking. So please post your code so we can help.

  13. #13
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    HI,
    thanks for your help.
    i suspect st wrong,
    i test the whole port b. it runs well (8 leds) - FOSC_INTIO67 (16x4mhz)
    However, when attaching portb to the 74hc595 - then 1 of the port pin lost power.
    just last week, the system run well @40mhz. (external osc).
    now problem is data to send out is not right
    i will spend 1 more time to check, and will send the program to you

    regards

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    when attaching portb to the 74hc595 - then 1 of the port pin lost power.
    I'm not really sure what this means , its rather ambiguous
    perhaps a schematic diagram (or a photo) of your setup would be in order

  15. #15
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    HI,,
    thANKS A LOT RICHARD,

    I MOVE TO USE 18F4620, THE PREVIOUS CONF. IS FINE (internal osc*4 = 32 mhz)
    the program runs well @40mhz (external osc) then there are problems
    i.e. data output randomly- (due to dirty breadboard)
    line appears on the screen (same cause above).
    i will going back to see the 18f26k20.next week.

    thanks again
    regards

  16. #16
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,596


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    As requested by others, post your complete code and a schematic of your circuit.

    Have you disabled analog features on any pins you use as digital?

    Robert

  17. #17
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: P1c18f26k20-internal clock set up fail -64mhz

    HI ALL
    THANKS for all
    the program actually runs well, but the pause time is not correct and the current supply is not adequate ( due to dirty breadboar...)

    at high frequency, some of the port pins is measured = 0, (when the port drives other ic) look like there is no power at all.
    the set up is right:

    _FOSC_INTIO67_1H
    OSCTUNE = $40
    OSCCON = $70

    the PBADEN = OFF, so the portb is digital I/O
    thanks a gain for all

    regards

Similar Threads

  1. 18F26K22 - Unable to get 64MHz Internal clock speed
    By Balachandar in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th July 2014, 16:53
  2. How to set the internal CPU speed?
    By Ramius in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th April 2011, 20:04
  3. UberNewbie can't set his clock...
    By Byte_Butcher in forum General
    Replies: 19
    Last Post: - 7th January 2009, 04:22
  4. external clock / internal clock
    By grounded in forum General
    Replies: 4
    Last Post: - 31st May 2008, 17:44
  5. How to set internal oscillator on 16F88
    By newgeppetto in forum Off Topic
    Replies: 0
    Last Post: - 3rd December 2005, 09:28

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