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.

generating interrupts on MSP430

Hello,

I need a guideline for generating a series of Timer interrupts on my code. I am using MSP4302618 and i have a 32 Khz crystal on my board, i can generate an interrupt by setting CCRO regitser values equal to given time. But now i want to generate a series of interrupts occuring at different time interval or on different conditons. For example there are four points T1,T2,T3,T4. My timer A is in contionus mode (i assume for this kind of thing i have to run in this mode). Is there anyone who can guide me how to generate such an interrupt by using TimerA. Should i use Capture mode or Compare mode. As until now i have only worked with Compare mode.

Best Regards

  • RFeng said:

    i want to generate a series of interrupts occuring at different time interval or on different conditons. For example there are four points T1,T2,T3,T4.

    Is there anyone who can guide me how to generate such an interrupt by using TimerA.

    What is the shortest time interval between these points T1, T2, T3 and T4?

    The method I would suggest is to configure the TimerA for an interrupt rate/interval that is the least common multiple of each of the points T1, T2, T3 and T4.  In this way, you could generate software timers which have the base clock rate, or tick, which is generated by the TimerA interrupt.

    As an example for the purpose of illustration, if the time intervals of your points were T1=10msec, T2=15msec, T3=30msec and T4=50msec, then the least common multiple would be 5msec.
    I would setup TimerA to generate interrupts on a 5msec basis, then in the TimerA interrupt service routine it would keep track of the system tick and perhaps update some data structures that account for the various time intervals T1, T2, T3 and T4.
    Once the software timers expire, then a "software task" can be generated which corresponds to point T1.  Then a new software timer can be configured.

     

    RFeng said:

    Should i use Capture mode or Compare mode. As until now i have only worked with Compare mode.

    I would think that Compare mode should be used.

**Attention** This is a public forum