|   |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Home |
In this chapter I'm going to explain the operation of the original PM-6668 counter, the way it was before the face lift. I'm going to use the original circuit diagram which was supplied with the counter as reference during this description. The original counter was controlled by a 8048 microcontroller. This controller is equipped with the astonishing amount of 1 kb of program ROM and the even more amazing 64 bytes of data RAM. Furthermore the controller is equipped with an 8 bit counter which is used as a pulse counter in this application. With a little trick it is possible to read the contents of the ROM in the 8048. For this purpose I've designed the 8049 SPY which will read the contents of practically every 8048 or 8049 processor. After disassembling the original program I knew every detail about reciprocal frequency counting which enabled me to transport the same principles to the new brains of the counter.
The PM-6668 uses an unconventional counting technique called reciprocal Frequency counting.
Reciprocal frequency counting broke through when micro controllers became affordable.
Nowadays it is not that unique anymore but it sure was when the counter was first released back in the late seventies.
A normal counter uses a fixed gate time and simply counts the number of pulses that are presented on the input.
Needless to say that you can only count 50 pulses if a 50Hz frequency is applied to an acceptable gate time of 1 second.
If you want to measure this low frequency with a 3 digit resolution you will have to increase the gate time to 10s.
And on top of this very low resolution there is also a ± 1 counting error caused by the unsynchronized nature of the gate time.
This error is particularly a big problem with these low frequencies.
In the case of a 50 Hz signal it means an additional error of 2% !
The gate time is not timed very accurately with reciprocal frequency counting as opposed to normal frequency counting principles where the precision of the gate time determines the final precision of the instrument.
In the PM6668 the gate is even timed by a software loop which results in a far from accurate gate time.
However this inaccuracy doesn't affect the meter's accuracy in any way.
The 10 MHz reference frequency can be generated in 3 different ways.
On the cheaper models it is generated by a fairly simple crystal oscillator.
Better results can be expected from the more expensive model with a temperature stabilized TCXO oscillator.
After counting the number of input and reference pulses during the gate time we can calculate the actual input frequency. Below you see the formula we use to calculate the frequency.
The 107 factor in the formula is of course the frequency of the reference oscillator. Given a gate time of 1 second and a reference oscillator of 10 MHz this will result in a constant 7 digit resolution.
Like I've said before the exact duration of the gate time is not very important.
As long as it is longer than 1 second we can be sure that the counter will have a resolution of 7 significant digits.
The PM6668 has 2 prescalers that divide the frequency applied on the inputs before it reaches the actual counter. The PM6667 version has only one prescaler because it lacks the HF input.
The LF prescaler divides the input frequency on the LF input by 10.
This divide by 10 prescaler serves two purposes.
First of all it lowers the input frequency to a maximum of 12 MHz to be processed by the rest of the counter.
The HF prescaler divides the frequency present on the HF input by 256.
Again the software compensates this by multiplying the measured frequency by 256.
This prescaler is included to extend the frequency range of the counter up to 1 GHz.
There must be a way for the PM6668 to select between the two inputs because the counter is completely auto ranging.
This is done by an RF detector on the HF input PCB.
The output level of this detector indicates the presence or absence of an HF frequency of at least 70 MHz.
Like I've said, the gate is carefully synchronized to the incoming pulses.
This will eliminate the traditional ± 1 counting error because we always count an exact multiple of the incoming frequency.
The counter will not wait indefinitely for the first input pulse to arrive. This would freeze the last reading in the display far too long in case the input signal is removed. Therefore the processor will restart the process after about 350ms while clearing the display to 0000000. Similarly it is also possible that the last pulse never arrives if the input signal is removed during the measurement. This time a software timer is started to wait about 1.5 seconds before we know for certain that no pulses of very low frequencies have arrived anymore. When this happens the processor will display 0000000 again and will start a new measurement.
The purpose of the event counter is to count all incoming pulses originating from one of the two prescalers during the gate time.
It must be large enough to count the maximum frequency (i.e. 12 MHz) during the longest gate time without overflowing.
Thus it should be capable of counting up to at least 12,000,000.
The top half of IC105 gets the highest input frequency and divides it by 2. This signal is then applied to the left half of IC110, which again will divide the frequency by 2. Then the resulting signal is applied to the decade counter array IC107 and IC108. It's the task of the software to compose a normal BCD value out of the results of these counters once the gate time is over. Therefore the result of the 8 decade counter array is multiplied by 4 and the outputs of both flip-flops is added to that result. This produces a counter that can count up to 399,999,999, which is more dan adequate for our purpose.
Now the software must correct the effects of the selected prescaler to get the real event count.
For the LF input we need to multiply the counter's result by 10 to get the actual number of events.
This is fairly easy, we only have to increment the decimal exponent value once to achieve that.
The purpose of the reference counter is to count the number of pulses originating from the 10 MHz reference oscillator during the gate time.
It must be capable of counting up to 10,000,000 during normal gate times of 1 second.
It may be obvious that it takes a bit more effort for the software to compose a normal decimal value from this counter.
First of all the internal 4 digit counter is multiplied by 256 * 256 = 65,536.
This is simply done by doubling the counted value 16 times.
This mechanism produces a counter that can count up to 9999 * 65,536 + 65,535 = 655,359,999. We only need to be able to count up to approximately 10,000,0000, so the resolution of the reference counter is also large enough to assure that no overflows will ever occur.
Up until here we've got 2 BCD values, the event counter and the reference counter.
Now we have to calculate the result.
This is not a very easy task for an 8048 processor which only knows how to add two 8 bit numbers together.
Calculating the result requires a floating point division.
Before we can divide the event counter by the reference counter we must normalize both values.
Normalizing is a procedure where both mantissas are left justified to enable to subtract both numbers from each other.
Now it's time for the actual division.
This is done by subtracting the reference counter from the event counter as often as we can.
We count the number of times it was possible to subtract without getting a negative result.
The result of this is the most significant mantissa digit of the result.
With long gate times all 7 digits are relevant and may be displayed without restriction.
But with short gate times the relevant resolution is less, in our case 20% of the normal resolution.
6 digit results are displayed right justified, leaving the left most digit blank. The decimal point is placed in such a way that it will not have to shift back and forth if we have to change resolution.
At last we know the result The only thing left to be done is to present the value on the display. The mantissa is easy, we only have to copy that to the display remembering that 6 digit values have to be right justified. Placing the decimal point and showing the right unit annunciator (Hz, kHz, MHz) is a bit more difficult.
The decimal point is always placed to the right of the 6th, 5th, or 4th digit (counting from the right).
This ensures that the decimal point will remain in the same location in both 6 digit and 7 digit resolution which makes it easier to interpret the result.
Positioning the decimal point and range annunciators is done in a very complicated way with a long range of comparisons. It would have been far easier and faster if a simple lookup table was used with just 10 entries telling it where the decimal point should go and what range it is in. Below you'll find this table showing you where the decimal points are for the different ranges in both resolutions.
I already mentioned that the Philips engineers made some peculiar detours in the software for the PM-6668. Here's how they manage to double a BCD number for instance:
Assume that the initial number is held in buffer A.
Buffer B is cleared first, then buffer A is added to buffer B to get an exact copy.
Then buffer A is added to buffer B once more, effectively doubling the value.
But now the result is in the wrong buffer so we have to move the result back to buffer A again.
I've already mentioned the strange and complicated way to place the decimal point and the way they determined what range annunciator to show. Apart from these peculiarities there are still some more strange things in the program, but those are not really worth mentioning here.
A few self tests are implemented in the system software. They are particularly useful to fill the entire ROM space for I can't think of another purpose for most of the tests. The most obvious self test is the segment test that you can see for a few seconds when the counter is switched on. All segments and annunciators are, or at least should be, on. In the mean time we perform some functionality tests. We'll start by checking the program ROM. For this purpose there are 4 routines that calculate a CRC value of each of the four 256 byte banks in ROM. Please note that the 8048 can only read data from the current bank, so that explains why there are 4 routines involved. ERROR 1 will be displayed if the CRC should fail. If you ask me a simple checksum could have done the trick too, a CRC is a bit heavy for this purpose. Next comes the RAM test. First the registers R0 and R1 are tested because we're going to use them as variables. Then a loop is started to test all remaining 62 bytes of RAM Memory. This test is fairly useless if you ask me. If the RAM did fail it would probably not have passed the previous CRC test anyway. And if we do find a faulty RAM location we're not even sure if we can actually display it because ERROR 1 is put in RAM first before it is copied to the display.
Finally some counters are tested.
We only test to see if they read 0 and remain 0.
No tests are made to assure that the counters can really count or that the internal counter in the microcontroller is operational.
Or to find out that the internal counter can generate interrupts.
These tests are equally important to assure a proper operation of the total instrument.
Philips managed to squeeze a complete reciprocal frequency counter in just 1kb of program memory. A remarkable result, considering the wild detours they took and useless tests they've made. If one would clean up the code a little and omit the useless tests it should even be possible to achieve the same result in just 3/4 k of ROM. Despite the remarks on the software, I think that the PM-6668 is a very nice little counter with good accuracy which can be put to good use in every day service and I'm very glad to own one. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||