Interrupt Service Routine for microcontroller

This is a discussion on Interrupt Service Routine for microcontroller within the C Programming forums, part of the General Programming Boards category; Right now I'm using codewarrior to program a hsc12 microcontroller using C. I want to figure out how to write ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    27

    Interrupt Service Routine for microcontroller

    Right now I'm using codewarrior to program a hsc12 microcontroller using C. I want to figure out how to write ISRs (Interrupt Service Routines). The include file that comes with codewarrior has names associated with each address of the ISR such as:

    #define vrti 0x0000FFF0
    ....

    However I'm not quite sure on how to actually write the ISR itself. If anybody has experience with this any kind of help would be appreciated.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Have you searched for microcontroller interrupt programming? Because I get a whole bunch of matches in random-popular-search-engine.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    27
    Well actually more specifically I want to know how to build a interrupt vector table.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That would consist of:
    1. Figuring out what the interrupt vector table looks like.
    2. Then figure out how you actually put stuff in there from C.

    I have built vector tables (or modified entries at least) for x86, 68K, 29K.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Sep 2008
    Posts
    27
    Well I know what the vector table for the hsc12 looks like. However I'm not quite sure how to build the actual table. This is what I have now.

    Code:
    typedef void (*near tIsrFunc)(void);
    const tIsrFunc _InterruptVectorTable[] @0xFF80 = {
    0,
    0,
    ...
    rti_isr
    ...
    };
    so for the interrupts that I want to ignore I put a 0. So my question is basically what am I supposed to put for entires in the vector table I want to ignore. Also how do I actually write the interrupt service routine for say "rti_isr".

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have no idea how to write rti_isr - what is rti?

    You probably can't just put zero in the vector table unless you know for sure that interrupt will absolutely never happen (including by programmer error). It is better to have a dummy-interrupt handler that deals with unknown interrupts [and possibly reports that in some way, e.g. count up a counter or write a message to the console or some such, so that you know that is happening].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. running my program as service
    By daher in forum Windows Programming
    Replies: 5
    Last Post: 09-05-2008, 01:30 PM
  2. Windows service status checking
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 06-01-2008, 09:19 AM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 06:49 PM
  4. Another windows service question... starting/stopping
    By BrianK in forum Windows Programming
    Replies: 1
    Last Post: 03-20-2003, 12:22 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21