Problem with "on Interrupt" and PIC18F4620


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    philtep's Avatar
    philtep Guest

    Default Problem with "on Interrupt" and PIC18F4620

    Hello all,
    I'm having an issue gettings the On Interrupt GoTo command to work.
    I've tried the following:

    DEFINE OSC 20

    led var PORTA.2


    INTCON2.6 = 1 ' Enable PORTB pullups
    INTCON2.7 = 1
    On Interrupt Goto myint ' Define interrupt handler
    INTCON = $90 ' Enable INTE interrupt

    loop: High led ' Turn LED on
    Goto loop ' Do it forever


    ' Interrupt handler
    Disable ' No interrupts past this point
    myint: Low led ' If we get here, turn LED off
    Pause 500 ' Wait .5 seconds
    INTCON.1 = 0 ' Clear interrupt flag
    Resume ' Return to main program
    Enable


    This is the PicBasic Pro example slightly modified for the PIC18.
    It doesn't run the myint.

    I've done other tests to where I monitor the value of INTCON on an LCD and the register IS getting triggered because INTCON.6 = 1 after I trigger the interrupt. Regardless tho, it doesn't execute the myint label.

    Is there anything I'm doing wrong? Any specific config changes I need to get PBP to compile it correctly maybe?

    Any help is greatly appreciated,

    Thanks,
    Philip

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Try: ADCON1 = 15

    Does it work now?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    philtep's Avatar
    philtep Guest


    Did you find this post helpful? Yes | No

    Talking Found the fix!

    Actually, I just stumbled on the fix. The clue was this warning I was getting when I compiled the code in MPLab.. it was saying the symbol _XINST_OFF_4L didn't exist. I kept looking at the P18F4620.INC and it was there, so I didn't know what was going on.

    Finally, I realized that I was looking at the P18F4620.Inc from the MPLab folder and not the one the code was using, inside the PBP folder. The PBP folder one was a bit different.

    After replacing the PBP file, the interrupts worked!!! I guess some other registers were wrong as well.

    I guess a WORD OF CAUTION for anyone else out there with wacky problems... Use the MPlab version of the .INC file.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    What file did you replace?

    The PBP 18F4620.inc file includes "default" config fuse settings, and includes the P18F4620.inc file in your MPLAB directory at assembly time, and the Microchip P18F4620 file includes _XINST_OFF_4L which is a perfectly valid config fuse option?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. ADCIN Problem
    By JavPar in forum General
    Replies: 33
    Last Post: - 20th January 2009, 03:36
  2. PIC18F4620 Programming problem
    By JavPar in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 6th December 2008, 04:21
  3. PIC18F4620 not Target Device
    By kiwipiper in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th October 2007, 19:42
  4. PIC18F4620 Troubles
    By CluckShot in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th May 2007, 03:02
  5. Problem with Interrupt on PIC18F4620 PORTB
    By rookie in forum Off Topic
    Replies: 1
    Last Post: - 22nd March 2007, 01:34

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