Menu

Interrupt vectors

Help
Joe Croft
2010-10-01
2012-12-09
  • Joe Croft

    Joe Croft - 2010-10-01

    Hi Yall,

    I'm trying to attach to the Interrupt for the analog comparator but my routine never seems to get called. It looks like it should be called because the ACO bit in the ACSR register is set.

    I have the following routine in my code. Is this the correct way for me to attach to an interrupt vector?

    void ANALOG_COMP_vect(void) __attribute__ ( ( signal, naked, used, externally_visible ) );
    void ANALOG_COMP_vect(void)
    {
       isrEnter();
       if ( ACSR & _BV(ACO) ) 
       {
          PORTA = 0x0;
       }
       else 
       {
          PORTA = 0xf0;
       }
       isrExit();
    }
    

    I also have the following defines in my config file:

    /* ISR header/footer functions --------------------------------------------- */
    #define  includeIsrEnter                         cfgTrue
    #define  includeIsrExit                          cfgTrue
    #define  includeIsrBegin                         cfgTrue
    #define  includeIsrEndReturn                     cfgTrue
    #define  includeIsrEndYield                      cfgTrue
    #define  includeIsrStartLoad                     cfgTrue
    #define  includeIsrStopLoad                      cfgTrue
    /* ========================================================================= */
    /* INTERRUPT HANDLING ====================================================== */
    /* ========================================================================= */
    #define  cfgIntGlobalOnly                        cfgTrue
    #define  cfgIntUserDefined                       cfgTrue
    #define  cfgIntSwitchUsesOSstack                 cfgTrue
    #define  cfgIntOsProtected                       cfgTrue
    #define  cfgIntTickTrack                         cfgFalse
    #define  cfgIntManualTicks                       cfgTrue
    

    Any help will be appreciated.

    Thanks,
      Joe

     
  • De Vlaam

    De Vlaam - 2010-10-01

    If the interrupt does not fire at all, the number of causes is not that big, most of which have nothing to do with the OS.
    (1) Did the program compile without warnings?
    (2) Is the setting of cfgSysGCCstartup equal to cfgKeep?
    (3) Did you start modifying the helloWorld example of did you make your own?
    (4) Is the hardware cause for the interrupt really present?
    Hopes this helps you out. Btw, you activated to many options, but they will not harm you, just costs bytes. If the problem remains, please zip your project and it to me (yes by mail) i will look if i can find the cause, and post the result here.

     
  • Joe Croft

    Joe Croft - 2010-10-02

    Thanks for the help. I moved over to the HelloWorld example configuration file, and found where I forgot to wrap several of the bit masks with _BV() and a few other goofy things and the world started working like I expect.

    Maybe one day I'll take the words in the documentation seriously ;).

    FemtoOS looks like it will turn out to be a great OS for my needs.  I really do appreciate the efforts that Ruud and the others have put into it.

    -joe

     
  • De Vlaam

    De Vlaam - 2010-10-02

    I really do appreciate the efforts that Ruud and the others have put into it.

    Thanks!

     

Log in to post a comment.