SLAA513B December 2011 – February 2022 MSP430G2112 , MSP430G2112 , MSP430G2152 , MSP430G2152 , MSP430G2212 , MSP430G2212 , MSP430G2252 , MSP430G2252 , MSP430G2312 , MSP430G2312 , MSP430G2352 , MSP430G2352 , MSP430G2412 , MSP430G2412 , MSP430G2452 , MSP430G2452
In some applications, it is necessary to generate multiple signals with unique frequencies simultaneously. In typical use of an MSP430 MCU, Up Mode or Up/Down Mode is used on the timer modules with each frequency generated corresponding to a unique timer module. Capture Compare Register 0 (TxCCR0) for each timer module is set at the beginning of the program to set the period of the timer. Additional Capture Compare Registers (TxCCRx) for each module can be set to a value at the beginning of the program to generate different duty cycles, but because the timer only counts up to the value in TxCCR0, everything on the timer module is done in reference to this same timer period. In this method, everything is set at the beginning of timer operation, and the settings are left constant from then on – everything is done in hardware, and there are no values that need to be reloaded in the ISR. Figure 1-1 shows the relationship of TxCCR0 value and period value t0 in Up Mode.
When using the single time base method, the number of frequencies that can be simultaneously produced on a particular MSP430 device is dependent on the number of timer modules on the MSP430 device, and the number of possible simultaneous duty cycles is dependent on the number of TxCCRx registers on each module minus 1.
For example, an MSP430F5529 device features TA0 with five capture/compare (CC) registers, TA1 with three CC registers, TA2 with three CC registers, and TB0 with seven CC registers. Therefore, using the single time base method on an MSP430F5529:
Number of Frequencies = 3 Timer_A modules + 1 Timer_B module = 4 Independent Frequencies
Number of Duty Cycles TA0 = 5 CC – 1 = 4 Duty Cycles at TA0 frequency
Number of Duty Cycles TA1 = 3 CC – 1 = 2 Duty Cycles at TA1 frequency
Number of Duty Cycles TA2 = 3 CC – 1 = 2 Duty Cycles at TA2 frequency
Number of Duty Cycles TB0 = 7 CC – 1 = 6 Duty Cycles at TB0 frequency