7-digit counter

This is 7-digit counter (frequency meter) measuring frequency up to 35 MHz. The decimal point is after MHz digit.

Hardware is very simple:

It contains :

  • PIC 16F84
  • 1 NPN low power HF Si transistor,
  • 16 character (2x8) in 1 Line LCD display,
  • Xtal 1..10 MHz,
  • some resistors, capacitors and 2 Si switching diodes...

Note:

LCD display is 16 character in 1 line LCD display PVC160101PTN which seems to be compatible with TWO LINES HITACHI LCD display, exept that it has 2x8 characters in 1 line.

The counter uses internal prescaler of PIC as low byte of counter, TMR0 as middle byte and some register as high byte of counter.

Some ideas were taken from "Simple low-cost digital frequency meter using a PIC 16C54" (frqmeter.asm) written by James Hutchby, MadLab Ltd. 1996

LCD interfacing was taken from AN587 and mainly from LCD.ASM written by Peter Ouwehand.

This software is free for private usage. It was created for HAM radio community members. Commercial exploatation is allowed only with permission of authors.

The measuring period is 100 000 us.
Procesor cycle is T = 4/fx [us,MHz], fx is Xtal frequency

Number of procesor cycles per measuring period:
N = 100 000/T procesor cycles
N = fx x 100 000/4 = 25 000 x fx

The main steps of measuring period:

  1. decode 3-byte value into 7 decimal numbers,
  2. decode decimal value of digit to chars,
  3. set decimal point if needed,
  4. output to PORTB (LCD),
  5. start measurement,
  6. test TMR0 overflow bite, if YES increase TimerH,
  7. goto 5 until measuring period is done,
  8. stop measurement,
  9. shift out precounter content,
  10. goto 1

Total timing formula:

N = 25 000 x fx = ((9*T1+4)*T2+4)*T3+5+9*T4+Z

How to set T1,T2....? Take prepared program!

You need also include files.