/****************************************************************************** * PIC USB * interrupt.c ******************************************************************************/ /** I N C L U D E S **********************************************************/ #include #include #include "system/interrupt/interrupt.h" #include "user\pelucheusb18.h" #include #include "io_cfg.h" // I/O pin mapping /** V A R I A B L E S ********************************************************/ extern word Tmr0Base,Tmr0BaseSuona; extern char inSuona; extern byte Options_Mode1; /** I N T E R R U P T V E C T O R S *****************************************/ #pragma code high_vector=0x08 #define SILICON_REV_A3 void interrupt_at_high_vector(void) { _asm #ifdef SILICON_REV_A3 CALL Foo, 1 // store current value of WREG, BSR, STATUS for a second time RETFIE 1 // FAST Foo: POP // clears return address of Foo call goto high_isr #else goto high_isr #endif _endasm } #pragma code #pragma code low_vector=0x18 void interrupt_at_low_vector(void) { _asm goto low_isr _endasm } #pragma code /** D E C L A R A T I O N S **************************************************/ /****************************************************************************** * Function: void high_isr(void) * PreCondition: None * Input: * Output: * Side Effects: * Overview: *****************************************************************************/ #pragma interrupt high_isr nosave=section("MATH_DATA"),section(".tmpdata") void high_isr(void) { static byte n; if(INTCONbits.TMR0IF) { // Timer 0 INTCONbits.TMR0IF=0; // clear bit IRQ if(inSuona) { WriteTimer0(Tmr0BaseSuona); // inizializzo TMR0 m_HoldMemBit=1; // esco da HOLD... n=SPIRXByteFast(); // read 1 byte from Flash m_HoldMemBit=0; // metto in HOLD... SPITXDAC(n); SPIAddr.l++; if(SPIAddr.l >= SPIAddr2.l) { if(Options_Mode1 & 0x80) // se loop... ; //finire! else fineSuonaBrano(); } if(!SPIAddr.b[0] && !(SPIAddr.b[1] & 0x1)) { CounterL++; // 40mS ? } } else { WriteTimer0(Tmr0Base); // inizializzo TMR0 CounterL++; // 40mS } // m_Led2Bit ^= 1; //check timer } /* ********************************************************************** ; PortB Change Interrupt Handler, calls RemoteWakeup to perform wakeup ; usarlo per suonare... restando normalmente in StandBy??? (risparmio batterie) ; **********************************************************************/ if(INTCONbits.RBIF) { // Timer 0 n=PORTB; // clear bit IRQ INTCONbits.RBIF=0; // clear bit IRQ SERVE?? /* suonaBrano(); */ /* ; occhio al Mac (v. tastiera Mac); qua cmq non m'interessa ; pagesel RemoteWakeup ; call RemoteWakeup */ } } /****************************************************************************** * Function: void low_isr(void) * PreCondition: None * Input: * Output: * Side Effects: * Overview: *****************************************************************************/ #pragma interruptlow low_isr void low_isr(void) { } #pragma code /** EOF interrupt.c **********************************************************/