You can remove all the division if:
loop 16 times
for I = 0 to 15
Since Charles has suggested to simplify deviding by 4 , then 16 x 4 = 64, so if you devide by 64 you will do only one division.
AdcValue = sample/64
or
AdcValue = sample >> 6
Hence, you don't need to change variable:
HPWM 1, AdcValue, 5000
Naturaly writing to CCPRxL, and CCPxCON4:5, as suggested in the previuos post is an additional improvement.
Cheers
Alberto
Last edited by aratti; - 1st December 2010 at 12:33.
All progress began with an idea
Bookmarks