Frage

Lines 50 - 69 in radiotimer.c represent a function called "radiotimer_start()".

This function, if I understand correctly, is written for an MSP430 x26x hardware.

At an abstract level, this function starts a timer that (I believe) executes periodically (the parameter passed in). But I am not able to understand at all how this works.

I was wondering if one of the experts from the community could please explain to me what is going on in each line of this function.

For example on line 61:

TACCTL2  =  CAP+SCS+CCIS1+CM_1;

Why is it adding so many values, and what is "capture mode"?

To be honest this entire function means nothing to me.

I would greatly appreciate it if one of the experts from the community could at least shed some light on how to figure out what any of these lines of code are doing, and possibly relate it to how a timer is started.

War es hilfreich?

Lösung

That register is just setting a bunch of bits in it. The + is essentially an OR in this case. The statement can be rewritten as:

TACCTL2  =  CAP | SCS | CCIS1 | CM_1;

The info for each #define (CAP, SCS, CCIS1, and CM_1) should be in the libraries you are using. bits they set are shown on page 372 of the doc you linked.

CM_1 for example indicates capturing on the rising edge.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top