Some possible problems with the Frequency Meter


Only the first 8 characters show on the display

There seem to be a couple of slightly different LCD display command formats. Most 16 character by 1 line displays behave themselves, faithfully displaying all 16 characters.

16 character by two line displays also behave themselves. You can also placed a fixed message on the second line by uncommenting (removing the semi-colon) the line that begins:

;#define  Two_Line
and replacing the string "1234567890ABCDEF" in line:
adv3      dt      "1234567890ABCDEF",0
I have found one display where only 8 characters were displayed. A "move to next line" command was required before the display would print the remaining 8 characters on the same line. To force the display to behave itself, uncomment the line:

;#define  Bad_Display


"I can't trim the oscillator to get it to read a known frequency exactly".

The existing program assumes that you will be using the same 4.000 MHz crystal as I have used (and it doesn't oscillate on exactly 4.000 MHz). You can adjust the "gate time" in the following code:
MS100    MOVLW     0xff        ; 100 MS DELAY LOOP
         MOVWF     COUNT1      ; 4 MHZ XTAL

         MOVLW     0x7e        ; Count up
         MOVWF     COUNT2      ; to roll-over

         MOVLW     0x19        ; (was 1B)
         MOVWF     COUNT3
This sets a 24 bit counter to hexadecimal ff7e19. This is counted UPWARD till it rolls over to 000000. Making this number bigger shortens the gate time and reduces the indicated frequency. Fine control may be exerted by adding or removing NOP instructions just before the line:
L3       INCFSZ    COUNT3,F