Description

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
Total timing formula:

N = 25 000 x fx = 60*[7*(37 + 3*T1) + 6 + 3*T2] + 6 + 9*T3 + Z  

where T1,T2,T3 are initial values of timing loops,

Z are additional tunig NOPs.

For different X-tals they differ. See the calculation example. This is a easiest way how to get them.... :-)

The main steps of measuring period:

  1. start measurement,
  2. precode decimal value of digit to segments,
  3. if it's 5th digit set decimal point,
  4. output to PortB,
  5. output digit number to PortA (numbers from left to right are 6543210),
  6. test TMR0 overflow bite, if YES increase TimerH,
  7. leave digit to light,
  8. increase digit number,
  9. if smaller than 7 goto 2,
  10. else set digit number to zero, decrease counter and goto 2,
  11. stop measurement,
  12. shift out precounter content,
  13. precode 3-byte value into 7 decimal numbers,
  14. goto 1