• AVR Freaks

PIC18F86J60 oscillator problem

Author
stoyanoff
Super Member
  • Total Posts : 252
  • Reward points : 0
  • Joined: 2011/01/10 03:37:28
  • Location: 0
  • Status: offline
2020/01/25 08:32:42 (permalink)
5 (1)

PIC18F86J60 oscillator problem

Greetings! I haven`t worked with this controller for a few years. I can`t setup the oscillator properly. I have 4.7uF cap connected to the Vcap. 2.32ohms to RBIAS, 10MHz quartz with 15pF caps and 1MOhm resistor in parallel. Here are my conf bits:

#pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on SWDTEN bit))
#pragma config STVR = ON // Stack Overflow/Underflow Reset Enable bit (Reset on stack overflow/underflow enabled)
#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
// CONFIG1H
#pragma config CP0 = OFF // Code Protection bit (Program memory is not code-protected)
// CONFIG2L
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config FOSC2 = OFF // Default/Reset System Clock Select bit (INTRC enabled as system clock when OSCCON<1:0> = 00)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor enabled)
#pragma config IESO = ON // Two-Speed Start-up (Internal/External Oscillator Switchover) Control bit (Two-Speed Start-up enabled)
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscaler Select bits (1:32768)
// CONFIG3L
// CONFIG3H
#pragma config CCP2MX = OFF // ECCP2 MUX bit (ECCP2/P2A is multiplexed with RE7 in Microcontroller mode (80-pin and 100-pin devices) or with RB3 in Extended Microcontroller mode (100-pin devices only))
#pragma config ECCPMX = OFF // ECCP MUX bit (ECCP1 outputs (P1B/P1C) are multiplexed with RH7 and RH6; ECCP3 outputs (P3B/P3C) are multiplexed with RH5 and RH4)
#pragma config ETHLED = OFF // Ethernet LED Enable bit (RA0/RA1 function as I/O regardless of Ethernet module status)

The problem is when I try a simple blink test, my oscillator is very slow. Like I`ve sellected the internal oscillator. For example I have to set the _XTAL_FREQ atleast 1000 times lower then the 10MHz...
Any ideas what is going on?
Thanks!
#1

3 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 10345
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: PIC18F86J60 oscillator problem 2020/01/25 08:50:38 (permalink)
    0
    config FOSC2 ?  OSCCON<1:0> ?
    #2
    stoyanoff
    Super Member
    • Total Posts : 252
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC18F86J60 oscillator problem 2020/01/25 09:08:54 (permalink)
    0
    I`ve tried this too- no effect! Sorry, I`ve tried muplitple setting there.
    One more thing. When I try to debug the program - I can`t -> the error is The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings.
    #3
    stoyanoff
    Super Member
    • Total Posts : 252
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC18F86J60 oscillator problem 2020/01/25 09:47:18 (permalink)
    +2 (2)
    I am a complete idiot! I haven`t seen properly the controller ID! It is 86J65, not 86J60. Now everything is fine!
    Thanks!
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5