hello guys i have some problem with pwm ,i want to control a servo motor with adc ,i cant make 20 ms period....i tried but max is 16 ms...i don t know wath i do wrog ,pls help.
You have set the oscillator to HS but there is no crystal in your schematic. Therefore it is probably some artifact of the simulator that is providing you with a primary clock source and that could be any frequency.
You need to actively set the oscillator correctly. The use of the <xc.h> include makes me think you are using the XC8 compiler - just in case you misunderstand this (many do when starting out with the XC-series compilers) the _XTAL_FREQ define is not used by anything except the compiler-supplied delay macros and whatever you put into your code.
Susan