Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: ADC values to change PWM using TA0CCR1 register, not decreasing

$
0
0
Hi Micah! The reason is your |= for assigning values to TA0CCR1. This is the wrong operator here. Once a bit got set in the register, another |= will only set more bits (if not set already), but it can never clear any. Use = instead. Better always use = for register settings, so all |= can be replaced by = in your program. And you should use brackets when testing for multiple clauses: if( (ADC10MEM > 50) && (...) ) { ... } Why do you use those magic HEX values instead of real numbers? 0xFF is 255. It is easier to read. Dennis

Viewing all articles
Browse latest Browse all 62309

Trending Articles



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