1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Help with interrupts please

Discussion in 'Embedded' started by panfilero, Mar 24, 2007.

  1. panfilero

    panfilero Guest

    Hello

    I'm having a heck of a time trying to get interrupts to work on my
    MCU. All my coding is in C, and basically I want to jump to an isr
    whenever I sense something in my serial port. So I wrote a function
    like this:

    interrupt 20 void isr(void) {....}

    the function just spits out some characters to let me know it's ok. I
    found the number 20 in my data sheet listed as the "Vector Num"

    so.... in my main() I have enabled interrupts and I have enabled the
    RDRF interrupt by setting the REI bit .... I figured that by doing
    that if something comes into my serial port, I would be sent to that
    other function.... but it's not working at all.....

    I don't know if this is how the RDRF interrupt works, does anyone know
    what I'm doing wrong?

    Thank you
    Joshua

    PS - I'm using an HCS12 MCU and Codewarrior
     
    panfilero, Mar 24, 2007
    #1
    1. Advertisements

  2. panfilero

    Jack Klein Guest

    I'm not familiar with that particular part, but if that's all you're
    doing to get this particular interrupt to work, I can see why you're
    having a problem. Have you set a baud rate and enabled the serial
    port to receive?

    If your purpose is to test your ability to work with your tool set and
    successfully write an ISR function in C, it might be easier to get one
    of the micro's timers working and get a timer ISR to work, that way
    you're not dependent on a data stream from an external source.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Mar 24, 2007
    #2
    1. Advertisements

  3. panfilero

    panfilero Guest

    Hi

    I have the serial port initialized and can transfer data to and from
    it. I just have a system that is running a program and whenever it
    recieves something on the serial port I need it to go and do something
    else. In my data sheet it says my Interupt Vector address for the
    serial port is $FFD6.... I think I'm suppose to put the address of my
    isr at the $FFD6 memory location. and then when I recieve something
    at the serial port I will go into my isr.... but I'm coding in C (not
    that I could do this in any other language) and I don't know how to
    put the address of my isr at $FFD6......

    basically I don't know how to write an isr in C, I thought if I typed:
    Interrupt 20 void isr(void) it would do it, but it doesn't

    thanks
    Joshua
     
    panfilero, Mar 24, 2007
    #3
  4. Have you searched all the supplied examples, for the word interrupt ?
    It's not an unusual or rare thing you are trying, so they will
    probably have interrupts in some examples.

    -jg
     
    Jim Granville, Mar 24, 2007
    #4
  5. panfilero

    panfilero Guest

    thanks guys, it ended up being this software called "serial monitor"
    thats loaded on my demo board wasn't letting me use interrupts on the
    serial port.
     
    panfilero, Mar 24, 2007
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.