• AVR Freaks

Hot!XC8 cannot set function to ISR_Vector

Author
EH
Starting Member
  • Total Posts : 54
  • Reward points : 0
  • Joined: 2010/11/28 03:09:31
  • Location: 0
  • Status: offline
2021/01/18 07:11:48 (permalink)
0

XC8 cannot set function to ISR_Vector

Hi Community,
 
I`m using the PIC18F1320 together with the MPLAB X IDE 5.40 plus XC8 v2.10.
 
I want to place a function to the ISR-Vector, so as desribed in the docs, I used the "void interrupt isr(void)" instruction for it. But when I`m duing this, I get a error message, that the compiler is detecting a incomplete type "void" and expecting a ";" after top level declarator. See the picture.
 
What I have to do else, that the compiler is satisfied.
 
Thank you for the support
Henry

Attached Image(s)

#1

9 Replies Related Threads

    domble
    Super Member
    • Total Posts : 196
    • Reward points : 0
    • Joined: 2007/01/25 04:11:53
    • Location: UK
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/18 08:20:43 (permalink)
    +1 (1)
    From the PIC18F project I'm working on right now...
     

    void __interrupt(low_priority) low_isr(void)
    {
    // low priority interrupt code here
    }
     
    void __interrupt(high_priority) high_isr(void)   
    {
    // high priority interrupt code here
    }

     
    dom
     
    p.s. projcects? :-P
     
    #2
    mbrowning
    USNA79
    • Total Posts : 1875
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/18 09:30:40 (permalink)
    +3 (3)
    I think you are using XC8 in C99 mode, but the interrupt syntax you are trying to use is from C89/C90 mode. Check the compiler manual (section 4.9.1 for C99 mode) for proper interrupt syntax, or change mode to C90.
    #3
    ric
    Super Member
    • Total Posts : 29951
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: XC8 cannot set function to ISR_Vector 2021/01/18 12:16:13 (permalink)
    +2 (2)
    EH
    I want to place a function to the ISR-Vector, so as desribed in the docs, I used the "void interrupt isr(void)" instruction for it.

    Which docs?
    XC8 version 2.xx supports two modes (C90 and C99), and comes with two user manuals.
    Any old examples, intended for XC8 version 1.xx require C90 mode.
    See:
    https://microchipdeveloper.com/xc8:whats-new-in-xc8-2-0
    and
    https://microchipdevelope..m/xc8:moving-to-xc8-2-0

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    EH
    Starting Member
    • Total Posts : 54
    • Reward points : 0
    • Joined: 2010/11/28 03:09:31
    • Location: 0
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/19 02:32:07 (permalink)
    +1 (1)
    Hi All of the responders,
     
    thank you for your hints. Seems I was not up to date. So, I`ll study the news.
     
    Greetings
    Henry
    #5
    domble
    Super Member
    • Total Posts : 196
    • Reward points : 0
    • Joined: 2007/01/25 04:11:53
    • Location: UK
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/19 03:14:56 (permalink)
    0
    Ah - so https://microchipdeveloper.com/faq:31 is for C90 mode?  Would be handy if m'chip added a note to that effect! 
     
    dom.
     
    #6
    ric
    Super Member
    • Total Posts : 29951
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: XC8 cannot set function to ISR_Vector 2021/01/19 03:28:44 (permalink)
    +2 (2)
    Plainly that was written long before v2.xx was ever thought of.
    The top of the source says (with a mis-spelling):
    Complier:       XC8 v1.00 or higher

    So plainly it was written for 1.xx, and they never imagined it changing.
    "or higher" turned out to be over optimistic.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #7
    1and0
    Access is Denied
    • Total Posts : 12108
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/19 03:34:05 (permalink)
    +1 (1)
    ric
    Plainly that was written long before v2.xx was ever thought of.
    The top of the source says (with a mis-spelling):
    Complier:       XC8 v1.00 or higher

    So plainly it was written for 1.xx, and they never imagined it changing.
    "or higher" turned out to be over optimistic.

    With the given changes, it would be nice if XC8 compiler outputs a more useful message. ;)
    #8
    mlp
    boots too small
    • Total Posts : 1005
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/21 19:02:21 (permalink)
    +1 (3)
    1and0
    With the given changes, it would be nice if XC8 compiler outputs a more useful message. ;)

    Can't output a "more useful message" without investing developer time.
    Can't invest developer time without a pressing customer use case.
     
    Buy <enough> chips every <time-period> and demand your "more useful message" - you'll get it.
    But you will have to wait longer for other fixes.
    Your call.
     
    When I say "Buy <enough> chips every <time-period> and demand X" this is a statement from experience. A customer wanted to be able to limit the scope of (some) optimizations so they could (if I recall) guarantee byte-identical binaries to what they had got from a pre-OCG compiler so they would not need to pay to get their code re-certified by some external body. They bought enough chips that management pulled us off actual useful development to add this new "feature". It took months, and other fixes were delayed. The presence of the option still confuses users who try turning it on because it's there (I see them here on the forums). It's there, and insufficiently documented to dissuade them from trying it because we were not allowed to document it as "really, just for the special-case requirement of Customer X - if you're not them, it will break things."

    Mark (this opinion available for hire)
    #9
    1and0
    Access is Denied
    • Total Posts : 12108
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 cannot set function to ISR_Vector 2021/01/22 01:02:03 (permalink)
    +1 (1)
    mark.pappin
    Can't output a "more useful message" without investing developer time.
    Can't invest developer time without a pressing customer use case.

    I guess it must be too much to ask for it to recognize the keyword "interrupt" and flag a useful message when it is used in C99 mode.
     

    Buy <enough> chips every <time-period> and demand your "more useful message" - you'll get it.
    But you will have to wait longer for other fixes.
    Your call.

    I buy <zero> chips ... ;)
     
    #10
    Jump to:
    © 2021 APG vNext Commercial Version 4.5