dsPIC30F5015 TIMER1

PIC 2016. 3. 17. 14:59

void Init_TIMER(void)

{

T1CON = 0;            // Clear the Timer 1 configuration

    TMR1 = 0;             // Reset Timer 1 counter

    PR1=1474;             //1m sec = 14740, 100u sec = 1474, pr1 1==0.067842*10^-6

    T1CONbits.TON=0;   //TIMER1 ON

    T1CONbits.TSIDL=0;

    T1CONbits.TGATE=0;

    T1CONbits.TCKPS=0;

    T1CONbits.TSYNC=0;

    T1CONbits.TCS=0;


    IFS0bits.T1IF=0;

    IEC0bits.T1IE=1;

    T1CONbits.TON=1;    //TIMER1 ON

}


void __attribute__((interrupt, auto_psv)) _ADCInterrupt(void)

{

IEC0bits.ADIE = 0;

      IFS0bits.ADIF = 0;

      

      adc_flag=0;    //내용

     IEC0bits.ADIE = 1;

}



'PIC' 카테고리의 다른 글

dsPIC30F5015 10Bit ADC  (0) 2016.03.17
Posted by 차희빈

차희빈

달력