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.

capture mode up direction

 

what I'm doing wrong, trying to load TACCR0 and setup capture in up direction with the following,

debugger shows CCR0 is not loading, thanks for your help 

 

 

TACCTL0 = CM_1 + CCIS_0 + SCS + CAP +CCIE;// rising edge, interrupt enable  

TACCTL0  &= ~COV;                                                // reset overflow

TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR;      // up mode, ACLK

TA0CCR0 = 0X0FFF;                                                // load CCR0  not working

 

  • What happens if you use continuous mode instead of up mode?

  • It works in continuous mode 

  • That makes sense. Capturing into CCR0 in up mode is an odd combination, since triggering a capture would change the target value of the counter to equal its current value.

    I didn't notice anything to suggest that continuous mode is necessary for capturing in the user guide, but wouldn't be too surprised if that were the case.

    Is there some particular reason you want to use this combination?

  • just wanted to limit the time for the external pulse to cause interrupt, this morning

    tested and seems to load by modifying, thanks for your help    

     

    TACCTL0 = CM_1 + CCIS_0 + SCS + CAP +CCIE;// rising edge, interrupt enable  

    TACCTL0  &= ~COV;                                                // reset overflow

    TACTL = TASSEL_1 + ID_0 + MC_1;  // + TACLR;      // up mode, ACLK

    TA0CCR0 = 0X0FFF;                                                // load CCR0  not working

     

     

        

  • james george said:
    just wanted to limit the time for the external pulse to cause interrupt

    I think you can do that with one of the other capture/compare registers. Set the timer to run in continuous mode. Use one CCR to capture your input signal, and set another to compare mode using your time limit. When TAR reaches the value in the "compare" register the time limit has been reached and the resulting interrupt can be used to end the capture process.

  • thanks for the that input, i'll try it,  looks like it stop loading what i posted earlier, but i did see the debugger register window loading the CCR0 but now it's not, mystery continues         

  • Robert Cowsill said:
    Capturing into CCR0 in up mode is an odd combination, since triggering a capture would change the target value of the counter to equal its current value.

    Indeed, using up mode and capturing to CCR0 is an odd combination. Because each capture will shrink the timer cycle time, which is controlled by CCR0 in up mode.
    I can imagine some weird use for this. Imagine a retriggerable monoflop. The trigger is connected to CCR1 output, the output is connected to CCR0 capture input. This way, the timer would cycle faster and the CCR1 trigger output would pulse faster too) while each time the monoflop still expires, the CCR0 capture will further shrink the cycle time. Once the timer cycle is so short that the monoflop won’t expire anymore, you’ll have your exact monoflop duration in CCR0.
    Well, this could be done much easier with a software, but it is a plain hardware solution that uses this strange setup :)

    However, for any other CCR, capture can be done without limitations in up or up/down mode as well as in cont mode.

**Attention** This is a public forum