Using PIC18F4520 to measure slow period/Frequency
Your code is probably doing exactly what its meant to be doing. Try this to confirm:


Remove this line: period = (float)period;. period is not a float so that's not going to work.
Change this line: Frequency = (1/period ); to this, Frequency = (1.0/period ); to perform floating point division (otherwise Frequency will always be zero).
Change this line: sprintf(string,”%.3gms”,period); to this sprintf(string,”%u,%u”,start, end);. You can't use the g format specify for an unsigned int. The compiler would have surely warned you about that.


Now what do you get on the LCD for start and end? If they're both the same, then the code is working fine, and period should indeed be zero.

To find out why, check the signal on the CCP1 input pin (it may be changing quicker than you expect) and check the speed of your timer (it may not be incrementing a quickly as you think).