- /************************************************************************************************************
- * Timer2 Capture interrupt subroutine
- ************************************************************************************************************/
- void Capture_ISR (void) interrupt 12
- {
- clr_CAPF0; // clear capture0 interrupt flag
- P1 = C0L; // For capture mode CxL/CxH with data capture from I/O pin
- P2 = C0H;
- P12 = ~P12; //toggle GPIO1 to show int
- printf("\n TM2 CAP 0x%bX",C0H);
- clr_TF2;
- }
- /************************************************************************************************************
- * Main function
- ************************************************************************************************************/
- void main (void)
- {
- Set_All_GPIO_Quasi_Mode;
- InitialUART0_Timer3(115200);
- P00_Input_Mode;
- P00 = 1;
- TIMER2_CAP0_Capture_Mode;
- IC3_P00_CAP0_BothEdge_Capture;
-
- set_ECAP; //Enable Capture interrupt
- set_TR2; //Triger Timer2
- set_EA;
- while(1);
- }
|