This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6747 how to reset timer

hi

i use   external clock source to drive  timer1:2. i want to konw how to reset my timer and clear the count value in TIM12 in active status.

in which situation that i can write TIM12?  how to make sure whether  TIM12 or PRD12 is changed?

  • my reset code is below,is this right?

    CSL_FINST(tmr0Regs->TCR,TMR_TCR_ENAMODE12,DISABLE);
      
      tmr0Regs->TGCR = CSL_FMKT(TMR_TGCR_TIM12RS,RESET);
      CSL_FINST(tmr0Regs->TGCR, TMR_TGCR_PLUSEN, DISABLE);
      CSL_FINS(tmr0Regs->PRD12,TMR_PRD12_PRD12,0x10);  
       CSL_FINST(tmr0Regs->TIM12,TMR_TIM12_TIM12,RESETVAL);

        /* Select 32 bit unchained mode  */
        /* Take the timer out of reset */
       tmr0Regs->TGCR = CSL_FMKT(TMR_TGCR_TIMMODE,32BIT_UNCHAIN)
                                           | CSL_FMKT(TMR_TGCR_TIM12RS,NO_RESET);
                 
        // in  contious and reload mode select the number to reload 
        CSL_FINST(tmr0Regs->TGCR, TMR_TGCR_PLUSEN, ENABLE);
        CSL_FINST(tmr0Regs->TCR,TMR_TCR_ENAMODE12,EN_CONTRELOAD); // contious and reload mode  

  • Theo Chen,

    Please review the 64-Bit Timer User's Guide Section 2.1.5.2 "Writing to Registers of an Active Timer".

    That section states which registers may not be written during active timer operation. If you wish to change any of those timer registers during active operation, you must stop the timer, write to them as needed, and then resume the timer counting.

    Regards,
    RandyP