Configuration Timer Microchip

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From French to

Threaded View

j'ai une question concernant la configuration d'un timer sur un PIC24F.

(ww1.microchip.com/downloads/en/DeviceDoc/39704a.pdf#9):

/* The following code example will enable Timer1 interrupts, load the
Timer1
Period register and start Timer1.
When a Timer1 period match interrupt occurs, the interrupt service
routine must clear the Timer1 interrupt status flag in software.
*/
T1CON = 0x00; //Stops the Timer1 and reset control reg.
TMR1 = 0x00; //Clear contents of the timer register
PR1 = 0xFFFF; //Load the Period register with the value 0xFFFF
IPC0bits.T1IP = 0x01; //Setup Timer1 interrupt for desired priority level
// (This example assigns level 1 priority)
IFS0bits.T1IF = 0; //Clear the Timer1 interrupt status flag
IEC0bits.T1IE = 1; //Enable Timer1 interrupts
T1CONbits.TON = 1; //Start Timer1 with prescaler settings at 1:1 and
//clock source set to the internal instruction cycle





Je vous remercie par avance !



Re: Configuration Timer Microchip


Quoted text here. Click to load it

Quoted text here. Click to load it


Quoted text here. Click to load it

non il n'y a pas d'ordre pecis sauf que si tu demarre le timer avant de  
l'avoir initialise, il risque d'etre a la limite du debordement et donc  
de produire une interuption.


Re: Configuration Timer Microchip

Quoted text here. Click to load it
Bonjour Laurent,
je te remercie !


Site Timeline