Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 232907

Forum post: RE: CCS/MSP430FR2355: Read through ADC and vary duty cycle of PWM

$
0
0
"Not working" is a broad topic. What Does it do? -------------- > TB0CCR0 = 100; // PWM Period With a PWM period of 100, any value you assign to CCR1 has to be ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start > TB0CCR1=ADC_Result You're not waiting for the ADC to complete. Also, you're not enabling interrupts (GIE). I recommend you add > __bis_SR_register(LPM0_bits|GIE); // Enter LPM0, enabled between these two lines, so it waits for the ISR to run. -------------- Unsolicited: You're updating the PWM very fast, roughly once per cycle. This invites glitching. I suggest you also set CLLD, something like: > TB0CCTL1 = OUTMOD_7|CLLD_1; // CCR1 reset/set, update at start of cycle [Edit: Fixed wording slightly.]

Viewing all articles
Browse latest Browse all 232907

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>