Hi guys .I want to count the period of waveform that it will come from an external circuit using the ccp1.
My question is should i connect the vref+ on vdd and the vref- on the ground or is not necessary as long my waveform is until 5v . I am using pic18f4520.
Thank you
You are using the ADC?
If you use the ADC connect vref- to something, usually 0 volts.
If you use the ADC connect vref+ to the most positive voltage you want to measure. Usually 5V or 3.3V.
The ADC will not be happy with vref not connected.
OP, the CCP input triggers a capture upon the state change of the input. So your signal needs to change from a logic hi to lo or vice versa based on your config. Have a look at FIGURE 27-31 in the data sheet for the voltages associated with Hi and Lo states for a ST (Schmitt trigger input).
If your signal does not conform u may need to run it thru an opamp to adjust it. Remember the optimum PIC input impedance is 10K or less.