-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterrupts.c
139 lines (127 loc) · 9.04 KB
/
interrupts.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <xc.h>
#include <stdint.h> /* Includes uint16_t definition */
#include <stdbool.h> /* Includes true/false definition */
#include <timer.h>
#include <uart.h>
#include <stdio.h>
#include "main.h"
void InitTimers()
{
_NSTDIS = 0; // activation de la priorité des interruptions
AD1PCFGL = 0xFFFF; //Pins analogiques en numérique pour que ATP marche !!
Timer_Asserv_Init();
Timer_ms_Init();
// info : timer 5 est utilisé par la mesure des sicks
// info : timer 4 est utilisé par la mesure de l'ultrason
}
/******************************************************************************/
/* Interrupt Vector Options */
/******************************************************************************/
/* */
/* Refer to the C30 (MPLAB C Compiler for PIC24F MCUs and dsPIC33F DSCs) User */
/* Guide for an up to date list of the available interrupt options. */
/* Alternately these names can be pulled from the device linker scripts. */
/* */
/* dsPIC33F Primary Interrupt Vector Names: */
/* */
/* _INT0Interrupt _C1Interrupt */
/* _IC1Interrupt _DMA3Interrupt */
/* _OC1Interrupt _IC3Interrupt */
/* _T1Interrupt _IC4Interrupt */
/* _DMA0Interrupt _IC5Interrupt */
/* _IC2Interrupt _IC6Interrupt */
/* _OC2Interrupt _OC5Interrupt */
/* _T2Interrupt _OC6Interrupt */
/* _T3Interrupt _OC7Interrupt */
/* _SPI1ErrInterrupt _OC8Interrupt */
/* _SPI1Interrupt _DMA4Interrupt */
/* _U1RXInterrupt _T6Interrupt */
/* _U1TXInterrupt _T7Interrupt */
/* _ADC1Interrupt _SI2C2Interrupt */
/* _DMA1Interrupt _MI2C2Interrupt */
/* _SI2C1Interrupt _T8Interrupt */
/* _MI2C1Interrupt _T9Interrupt */
/* _CNInterrupt _INT3Interrupt */
/* _INT1Interrupt _INT4Interrupt */
/* _ADC2Interrupt _C2RxRdyInterrupt */
/* _DMA2Interrupt _C2Interrupt */
/* _OC3Interrupt _DCIErrInterrupt */
/* _OC4Interrupt _DCIInterrupt */
/* _T4Interrupt _DMA5Interrupt */
/* _T5Interrupt _U1ErrInterrupt */
/* _INT2Interrupt _U2ErrInterrupt */
/* _U2RXInterrupt _DMA6Interrupt */
/* _U2TXInterrupt _DPIN_LAISSEMA7Interrupt */
/* _SPI2ErrInterrupt _C1TxReqInterrupt */
/* _SPI2Interrupt _C2TxReqInterrupt */
/* _C1RxRdyInterrupt PIN_LAISSE */
/* */
/* dsPIC33E Primary Interrupt Vector Names: */
/* */
/* _INT0Interrupt _IC4Interrupt _U4TXInterrupt */
/* _IC1Interrupt _IC5Interrupt _SPI3ErrInterrupt */
/* _OC1Interrupt _IC6Interrupt _SPI3Interrupt */
/* _T1Interrupt _OC5Interrupt _OC9Interrupt */
/* _DMA0Interrupt _OC6Interrupt _IC9Interrupt */
/* _IC2Interrupt _OC7Interrupt _PWM1Interrupt */
/* _OC2Interrupt _OC8Interrupt _PWM2Interrupt */
/* _T2Interrupt _PMPInterrupt _PWM3Interrupt */
/* _T3Interrupt _DMA4Interrupt _PWM4Interrupt */
/* _SPI1ErrInterrupt _T6Interrupt _PWM5Interrupt */
/* _SPI1Interrupt _T7Interrupt _PWM6Interrupt */
/* _U1RXInterrupt _SI2C2Interrupt _PWM7Interrupt */
/* _U1TXInterrupt _MI2C2Interrupt _DMA8Interrupt */
/* _AD1Interrupt _T8Interrupt _DMA9Interrupt */
/* _DMA1Interrupt _T9Interrupt _DMA10Interrupt */
/* _NVMInterrupt _INT3Interrupt _DMA11Interrupt */
/* _SI2C1Interrupt _INT4Interrupt _SPI4ErrInterrupt */
/* _MI2C1Interrupt _C2RxRdyInterrupt _SPI4Interrupt */
/* _CM1Interrupt _C2Interrupt _OC10Interrupt */
/* _CNInterrupt _QEI1Interrupt _IC10Interrupt */
/* _INT1Interrupt _DCIEInterrupt _OC11Interrupt */
/* _AD2Interrupt _DCIInterrupt _IC11Interrupt */
/* _IC7Interrupt _DMA5Interrupt _OC12Interrupt */
/* _IC8Interrupt _RTCCInterrupt _IC12Interrupt */
/* _DMA2Interrupt _U1ErrInterrupt _DMA12Interrupt */
/* _OC3Interrupt _U2ErrInterrupt _DMA13Interrupt */
/* _OC4Interrupt _CRCInterrupt _DMA14Interrupt */
/* _T4Interrupt _DMA6Interrupt _OC13Interrupt */
/* _T5Interrupt _DMA7Interrupt _IC13Interrupt */
/* _INT2Interrupt _C1TxReqInterrupt _OC14Interrupt */
/* _U2RXInterrupt _C2TxReqInterrupt _IC14Interrupt */
/* _U2TXInterrupt _QEI2Interrupt _OC15Interrupt */
/* _SPI2ErrInterrupt _U3ErrInterrupt _IC15Interrupt */
/* _SPI2Interrupt _U3RXInterrupt _OC16Interrupt */
/* _C1RxRdyInterrupt _U3TXInterrupt _IC16Interrupt */
/* _C1Interrupt _USB1Interrupt _ICDInterrupt */
/* _DMA3Interrupt _U4ErrInterrupt _PWMSpEventMatchInterrupt */
/* _IC3Interrupt _U4RXInterrupt _PWMSecSpEventMatchInterrupt */
/* */
/* For alternate interrupt vector naming, simply add 'Alt' between the prim. */
/* interrupt vector name '_' and the first character of the primary interrupt */
/* vector name. There is no Alternate Vector or 'AIVT' for the 33E family. */
/* */
/* For example, the vector name _ADC2Interrupt becomes _AltADC2Interrupt in */
/* the alternate vector table. */
/* */
/* Example Syntax: */
/* */
/* void __attribute__((interrupt,auto_psv)) <Vector Name>(void) */
/* { */
/* <Clear Interrupt Flag> */
/* } */
/* */
/* For more comprehensive interrupt examples refer to the C30 (MPLAB C */
/* Compiler for PIC24 MCUs and dsPIC DSCs) User Guide in the */
/* <C30 compiler instal directory>/doc directory for the latest compiler */
/* release. For XC16, refer to the MPLAB XC16 C Compiler User's Guide in the */
/* <XC16 compiler instal directory>/doc folder. */
/* */
/******************************************************************************/
/* Interrupt Routines */
/******************************************************************************/
void __attribute__((interrupt, no_auto_psv)) _SPI2Interrupt(void)
{
led=1;
IFS2bits.SPI2IF = 0;
}