Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Need help with MSP430 program?
Configure the MSP430 as a simple frequency synthesizer. It should act as a frequency multiplier and frequency divider--as well as a duty cycle converter.
Assume a periodic digital waveform (square wave) is applied to the P1.1 pin of our MSP430 (MSP430G2231). You are interested in measuring the frequency and duty cycle of that waveform using input capture. The MSP430 needs to generate an output digital waveform (square wave) on P1.6. The MSP430 should take continuous measurement of the frequency and duty cycle of the input waveform (using input capture). The output waveform should be determined as a function of two switch inputs tied to P1.0 and P1.2:
P1.0 P1.2 Output Waveform (P1.6)
0 0 Double the input (P1.1) frequency, 50% duty cycle regardless of input duty cycle
0 1 Double the input (P1.1) frequency, opposite duty cycle of the input duty cycle
1 0 1/3rd the input (P1.1) frequency, 50% duty cycle regardless of input duty cycle
1 1 1/3rd the input (P1.1) frequency, opposite duty cycle of the input duty cycle
By "opposite duty cycle", if the input has a 30% duty cycle, the output should have a 70% duty cycle.
Use input capture and output compare simultaneously (using the only 2 capture/compare channels available).
Since we have only one Timer_A module (one TAR with 2 capture/compare channels) and we need to keep TAR counting in continuous mode for the sake of input capture, we cannot use "up" and "up/down" count modes for generating the waveform using output compare. This means to vary the frequency and duty cycle of the output, CPU intervention will be required to continually re-write the compare register with ever-changing values. This means both input capture and output compare should be configured to use generate interrupts. To save power, the state of the input switches can be checked in the output compare ISR to determine what action to take. The main loop can be configured to go into a low power mode after any one-shot peripheral initialization is taken care of.
Your intuition should tell you that you can't measure an arbitrarily fast input on P1.1--nor generate an arbitrarily fast output on P1.6. Measuring very slow inputs or generating very slow outputs will also prove challenging. You are not required to handle cases where the TAR register may overflow more than once! When calculating the output frequency, you are not required to handle multiprecision arithmetic (beyond 16-bit). Keep it simple.
1 Answer
- 10 years agoFavorite Answer
LOL, you people are weird. Study hard. Use the resources in a way that prevent under-utilization of your mind :P