Thread: Unfamiliar syntax of an ISR of a microcontroller

  1. #1
    Registered User
    Join Date
    Oct 2018
    Posts
    42

    Unfamiliar syntax of an ISR of a microcontroller

    While writing a program for an AVR microcontroller I came across this weird-looking function that was generated automatically by the IDE for an interrupt service routine (ISR):
    Code:
    interrupt [TIM0_COMP] void timer0_comp_isr(void){//...}
    Could someone please tell me about its syntax? I know how it works and what interrupts are, I'm just struggling with the C syntax so I'm asking it here. Especially, what kind of return type is that?! (Thanks in advance).

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    3,537
    It has no return type. That is what the first void means.
    It takes no parameters that is what the second void means.

    The "interrupt [TIM0_COMP]" is non standard that I am guessing it means when the event TIM0_COMP happens this code is called.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Oct 2018
    Posts
    42
    Yes that's exactly its meaning. So they have somehow ADDED something the C syntax in favor of their own need!?!? o-O It's very mysterious

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,337
    So they have somehow ADDED something the C syntax in favor of their own need!?!?
    Yes, and it's not mysterious at all since I'm sure that the compiler maker thoroughly documented that implementation defined feature which is quite common especially when dealing with small embedded systems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unfamiliar from of template
    By -Adrian in forum C++ Programming
    Replies: 1
    Last Post: 05-04-2016, 07:24 AM
  2. unfamiliar header definition
    By vassago in forum C Programming
    Replies: 10
    Last Post: 04-04-2010, 02:33 AM
  3. unfamiliar syntax
    By bean66 in forum C++ Programming
    Replies: 11
    Last Post: 04-02-2009, 12:36 PM
  4. Unfamiliar Function Syntax
    By Thunder in forum C Programming
    Replies: 5
    Last Post: 10-14-2003, 02:08 PM
  5. unfamiliar with linux
    By macronin in forum C++ Programming
    Replies: 0
    Last Post: 03-25-2002, 09:17 AM

Tags for this Thread