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:
- start measurement,
- precode decimal value of digit to segments,
- if it's 5th digit set decimal point,
- output to PortB,
- output digit number to PortA (numbers from left to right are 6543210),
- test TMR0 overflow bite, if YES increase TimerH,
- leave digit to light,
- increase digit number,
- if smaller than 7 goto 2,
- else set digit number to zero, decrease counter and goto 2,
- stop measurement,
- shift out precounter content,
- precode 3-byte value into 7 decimal numbers,
- goto 1
|