Bonjour,

n'étant pas très aguéri dans ce domaine pour le moment, j'essai d’approfondir mes connaissances à ce sujet et je m'exerce sur un starter kit de microchip sur un pic32MX795.

Jusqu'à présent j'ai toujours programmé du PIC lorsque celui-ci était déjà fonctionnel et je n'avais plus qu'à modifier ou faire évoluer les soft.

Actuellement, je n'arrive pas à comprendre le problème :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
/*********************************************************************
 *
 *      PIC32MX 
 *
 *********************************************************************
 *
 * FileName:        main.c
 *
 * Dependencies:    plib.h
 *
 * Processor:       PIC32MX
 *
 * Complier:        MPLAB C32
 *                  MPLAB IDE
 *
 * Company:        
 *
 * auteur:              
 *
 *********************************************************************/
#include <plib.h>
 
 
#if defined (__32MX360F512L__) || (__32MX460F512L__) || (__32MX795F512L__) || (__32MX430F064L__)
// Configuration Bit settings
// SYSCLK = 80 MHz (8MHz Crystal / FPLLIDIV * FPLLMUL / FPLLODIV)
// PBCLK = 80 MHz (SYSCLK / FPBDIV)
// Primary Osc w/PLL (XT+,HS+,EC+PLL)
// WDT OFF
// Other options are don't care
 
 
 
void clignotement(void);
 
 
int i,j;
 
 
 
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_1
//#define SYS_FREQ (80000000L)
#endif
 
// Let compile time pre-processor calculate the CORE_TICK_PERIOD
#define SYS_FREQ 				(80000000)
#define TOGGLES_PER_SEC			1
#define CORE_TICK_RATE	        (SYS_FREQ/5/TOGGLES_PER_SEC)
#define LED						0x00000007
 
 
 
 
 
 
void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void)
{
    // .. things to do
 
	// .. Toggle the LED
    mPORTDToggleBits(BIT_0);
	mPORTDToggleBits(BIT_1);
	mPORTDToggleBits(BIT_2);
	i++;
	//if (i==10) i=0;
    // update the period
    UpdateCoreTimer(CORE_TICK_RATE);
 
    // clear the interrupt flag
    mCTClearIntFlag();
}
 
 
void clignotement(void)
{
 
j=i;
//mPORTDToggleBits(BIT_0);
//mPORTDToggleBits(BIT_1);
//mPORTDToggleBits(BIT_2);
//UpdateCoreTimer(CORE_TICK_RATE);
//if (i<5) PORTD=0x00000007; else if(i>5) PORTD=0x00000000;
}
 
 
 
 
int main(void)
{
 
    // Configure the device for maximum performance but do not change the PBDIV
    // Given the options, this function will change the flash wait states, RAM
    // wait state and enable prefetch cache but will not change the PBDIV.
    // The PBDIV value is already set via the pragma FPBDIV option above.
    SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);
 
    // Explorer-16 LEDs are on lower 8-bits of PORTA and to use all LEDs, JTAG port must be disabled.
    mJTAGPortEnable(DEBUG_JTAGPORT_OFF);
 
    //Initialize the DB_UTILS IO channel
    DBINIT();
 
        // configure the core timer roll-over rate (100msec)
    OpenCoreTimer(CORE_TICK_RATE);
 
    // set up the core timer interrupt with a prioirty of 2 and zero sub-priority
    mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0));
 
    // Clear PORTA bits so there are no unexpected flashes when setting
    // them to output in the next step
    //mPORTDClearBits(BIT_2 |BIT_1 | BIT_0);
 
        // enable device multi-vector interrupts
    INTEnableSystemMultiVectoredInt();
 
    // Make lower four bits of PORTD as output
    mPORTDSetPinsDigitalOut(BIT_2 |BIT_1 | BIT_0);
 
    	//Now blink LEDs ON/OFF forever.
 		while (1)
		{
		clignotement();
 
		}
 
 
 
}
ce soft ce compile sans problème seulement j'ai fais une simple fonction :

clignotement();

et j'ai l'impression qu'il ne passe pas par ma fonction car j'ai juste une variable à l’intérieur et celle-ci ne bouge pas pendant l'execution alors que la variable i bouge.

Merci pour vos éclaircissements qui pourrons me faire avancer dans mon apprentissage.