bonjour à tous,
j'ai besoin de vos aides!
en fait, j'ai fait un petit programme pour générer 4 PWM, mais tout marche bien sauf la pwm4. y a t-il une particularité pour la pwm4?
voici le code:
#include "p30F2020.h"
_FOSCSEL(FRC_PLL)
_FOSC(CSW_FSCM_OFF & FRC_HI_RANGE & OSC2_CLKO)
_FPOR(PWRT_128)
_FGS(CODE_PROT_OFF)
_FBS(BSS_NO_FLASH)
int main(void)
{
TRISA=0; /* PORTA en sortie */
PORTAbits.RA9=1; /* allumer la led */
TRISB=1; /* PORTB en entrée */
PTPER = 46729;
MDC = 10280;
/* Initialize PWM Generator 1 */
IOCON1bits.PENH = 1;
IOCON1bits.PENL = 1;
IOCON1bits.POLH = 0;
IOCON1bits.POLL = 0;
IOCON1bits.PMOD = 1;
PWMCON1bits.MDCS = 1;
PWMCON1bits.DTC = 2;
PHASE1 = 0;
/* Initialize PWM Generator 2 */
IOCON2bits.PENH = 1;
IOCON2bits.PENL = 1;
IOCON2bits.POLH = 0;
IOCON2bits.POLL = 0;
IOCON2bits.PMOD = 1;
PWMCON2bits.MDCS = 1;
PWMCON2bits.DTC = 2;
PHASE2 = 11682;
/* Initialize PWM Generator 3 */
IOCON3bits.PENH = 1;
IOCON3bits.PENL = 1;
IOCON3bits.POLH = 0;
IOCON3bits.POLL = 0;
IOCON3bits.PMOD = 1;
PWMCON3bits.MDCS = 1;
PWMCON3bits.DTC = 2;
PHASE3 = 23364;
/* Initialize PWM Generator 4 */
IOCON4bits.PENH = 1;
IOCON4bits.PENL = 1;
IOCON4bits.POLH = 0;
IOCON4bits.POLL = 0;
IOCON4bits.PMOD = 1;
PWMCON4bits.MDCS = 1;
PWMCON4bits.DTC = 2;
PHASE4 = 35047;
PTCON = 0x8000;
while(1);
}
Merci d'avance
-----