Hi,
First ...
your ADC gives 1024 steps ...
HPWM has 256 steps
your PWMDuty has 512 possible values ...
sooooo .... pwmduty = analogvalue / 4 ...
OR .... DEFINE ADC_BITS 8 ' ADC resolution 8 bit
which is ... much better !!! ( try and see why ...)
Now, for PORTB.0 and B.7 ...
did you define their initial state somewhere ????
nooooo, you didn't !!! ... and you should had !!!
Have a Good day
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks