Trouble using int. osc. On 18f2455


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2007
    Posts
    9

    Default Trouble using int. osc. On 18f2455

    I m having trouble getting started with the 18f2455. I just upgraded to PBP 2.47 so I could work with USB pics . I have no problem programming other pics but I can only get this one to run with an external oscillator and even then it is sporadic and unreliable.

    Here is the code I am trying to use to blink an LED :

    define OSC 8
    OSCCON=%01110010


    loop:

    High PORTA.1 'Turn on LED
    Pause 500 ' Delay for .5 seconds
    Low PORTA.1 'Turn off LED
    Pause 500 ' Delay for .5 seconds
    Goto loop ' Go back to loop and blink LED forever

    End

    I am using the melbas programmer and setting the oscillator to: INTHS, HS Used By USB

    I have read PBP manual, the oscillator configurations section of the data sheet and tried to find something on this forum. I have also tried a bunch of other settings still no luck.
    I have a feeling I am overlooking something simple. If anyone has a suggestion I would appreciate it

    Thanks

    -kyle

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by KPDes View Post
    I m having trouble getting started with the 18f2455. I just upgraded to PBP 2.47 so I could work with USB pics . I have no problem programming other pics but I can only get this one to run with an external oscillator and even then it is sporadic and unreliable.
    I have a feeling I am overlooking something simple. If anyone has a suggestion I would appreciate it
    Thanks
    -kyle
    Cap across Vdd and Vss (and/or power supply input to the board)
    MCLR pullup resistor

  3. #3
    Join Date
    May 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Yea I checked that, power is getting to the pins and MCLR is pulled high

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by KPDes View Post
    Yea I checked that, power is getting to the pins and MCLR is pulled high
    No, I meant do you have a .1uf (or similar) capacitor across the power pins?
    And what value resistor do you have pulling MCLR high?

  5. #5
    Join Date
    May 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    The pull-up resistor I am using is 6K and I do have a capacitor over the power pins.

    I have gotten it to work by accident when it was programmed for an internal oscillator but the crystal and capacitors were still hooked up from when I was trying an external mode. It started working when I touched one of the capacitors off the crystal, I put it on the scope and the timing was right. It was like the extra capacitance kicked it off or something? Only sometimes this works and it doesn’t work when I set it to external mode. It makes me think it is a configuration problem but I’ve tried everything I can think of

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    this could be a breadboard problem. In many occasion it's extra capacitance may screw up things. Higher your crystal value is, worst it is. The trick is to keep every pins short (crystal and capacitors) and be able to mount them directly.

    Here's a setup for a 4MHz crystal
    Code:
        '
        '   Pic Configuration
        '   =================
        asm
        __CONFIG    _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L  
                                ;              ;                      ; USB clock source comes from the 96 MHz PLL divided by 2
                                ;              ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
                                ; No prescale (4 MHz oscillator input drives PLL directly)
    
    
        __CONFIG    _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H 
                                ;                  ;               ; Oscillator Switchover mode disabled
                                ;                  ; Fail-Safe Clock Monitor disabled
                                ; XT oscillator, PLL enabled, XT used by USB
                                
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L 
        endasm
        DEFINE OSC 48
    Have a look at the USBDemo thread and code, there you'll find some settings.

    http://www.picbasic.co.uk/forum/showthread.php?t=5418
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    May 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    I am still having trouble.

    I noticed the assembler gives the warning message:

    Warning[217] c:\pbp18f2550.inc 18 : Hex file format specified on command line

    Could this be the problem?

  8. #8
    Join Date
    May 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Problem solved!!

    after many hours of mister_e style head banging , I updated the not just the software (like i did before i made a post) but the firmware on my melabs U2 programmer that fixed the problem

Similar Threads

  1. Replies: 4
    Last Post: - 9th October 2009, 08:01
  2. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  3. strange int behaviour
    By tom in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2005, 15:41
  4. 18F2525 Int Osc settings?
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th March 2005, 22:44

Members who have read this thread : 0

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