We want to replace the original processor in the PM-6668 counter with our own processor circuitry.
The actual circuit is not that difficult to describe.
It mainly contains the main processor, an EPROM holding the program, and an EEPROM for storing non-volatile information.
Furthermore this circuit can also be expanded with a reference switch, which in fact is just one IC.
On this page you can find the complete description of this new processor board. You may also want to read the description of the original PM-6668 counter to fully understand the operation of the instrument.
The SDA30C163 is a 8051 derivative made by Siemens.
It was mainly targeted to be used in consumer electronics and that is exactly where I got it from.
Apart from the standard 8051 core the micro controller is equipped with some interesting new features.
One of the main improvements over the standard 8051 is the presence of 8 DPTR pointers, whereas the original 8051 only has one. Furthermore it only divides the oscillator frequency by 6, instead of 12, making the processor twice as fast than the standard 8051 with the same crystal. The standard RAM memory is 256 bytes, but another 1kB of XRAM was added to the chip which makes programming it a bit more convenient. Finally some extra hardware features were added, but none of them are of real interest for us, apart from the number of I/O pins of course.
There are two main reasons why I've chosen this processor (actually there were three, for this one was lying around simply begging to be used in some kind of project).
The first reason is because I wanted a processor that was closely related to the original 8048 to ease the transformation on the software side.
None of the 8048 derivate available on the market are powerful enough to come even close to be used for a project like this.
The next best thing is a processor with a 8051 core.
Another important reason why I particularly wanted to use a 8051 derivative is because its counter(s) can be used in exactly the same mode as the original 8048 counter.
I already mentioned that the clock can be divided by only 6.
This makes the processor run twice as fast as an original 8051 with the same crystal oscillator.
Not that I need that high speed for the original program ran on a 8048 at only 5 MHz, which is very close to single stepping :-)
But the main advantage of omitting this division by 2 is that it now becomes easier to obtain a baud rate of 9600 baud with a "normal" clock frequency of 12 MHz.
Most of the I/O lines of the processor are used to replace the original 8048's I/O lines. Only a few I/O lines are used on the processor board itself. These extra lines are needed as I²C bus, to control the reference switch and SB-Bus interface.
I've used an MC33164 reset IC to generate the reset signal for the main processor.
This IC will hold the reset pin to the processor low until it is absolutely certain that the power supply is stable enough for normal operation.
The power supply is only raised slowly on this IC because of the RC combination on its input. Once the voltage on the input exceeds 4.5V an internal timer is started. The output is released once this timer times out.
Needless to say that this will generate a very reliable reset signal, probably far better than absolutely necessary.
There's nothing much to be said about the EPROM circuit.
A 32kB type is used here, which is more than adequate for the 9.5kB program that is placed in it.
All address and data lines are directly connected to the processor. No address latch is necessary for this processor, unlike with the original 8051, which is another advantage.
The PSEN signal from the processor persuades the EPROM to present its data on the outputs.
The instrument needs to remember some data, even when it is switched off, even for a longer period of time.
A Non Volatile Memory device is used to do just that.
The X24C02 is an I²C controlled NVM with a data capacity of 256 bytes.
This memory will remember the different options, the SB-Bus address and the 50 different values in the Offset and Scaling lists.
The I²C bus requires 2 I/O lines from the processor.
One of the extra features of the SDA30C163 processor is the ability to address more than 64kB of program memory.
We don't need such a large amount of memory, so I used the 2 extra address lines as ordinary I/O lines.
At first this caused me some unexpected problems because of a little design error in the micro controller. By means of some mode bits you can select the 2 used lines as either being standard I/O or address extension lines individually. So I expected to get full control over the 2 lines when I do set them to be standard I/O lines.
WRONG! Because of a design error in the chip the extended return stack copies its contents to the I/O lines every time a RET instruction is executed. I can tell you that this will produce some unexpected results! The extended return stack is a small piece of separate memory that stores the most significant bits of the extended address pointer during subroutine calls. With a special trick I avoided this hardware bug. Normally the extension stack can not be manipulated, it is simply pointed to by a circular counter. During initialization time I push the whole extension stack full with logical ones, after which I reset the normal stack pointer to its original location.
This will prevent the extension stack to interfere with normal I/O operations on these two extra I/O pins.
The SB-Bus connection shown in the upper right hand corner shows all that is needed to make the interface connect to the outside world.
The two opto-couplers take care of the necessary galvanic insulation between the SB-Bus and the instrument.
As opposed to a normal SB-Bus interface this interface has only one SB-Bus connector. The reason for this is quite simple: there is not enough space on the back plane of the instrument to accommodate 2 connectors. This is not such a big problem, it simply implies that the counter will always have be the last instrument on the daisy chain on a particular port of the SB-Bus driver.
The UART output of the SDA30C163 controls a PNP emitter follower which will control the transmit opto-coupler.
The receiving opto-coupler can pull the UART input of the SDA30C163 low. Normally this input is held high by a 1kΩ resistor.
The two 100kΩ resistors speed up the transition time of the opto-couplers making the ramps somewhat steeper.
Most of the I/O lines must replace the functionality of the original processor.
The numbers at the terminals correspond to the original pin numbers of the 8048 that we are going to replace.
We also borrow the +5V power supply from the 8048 socket. The extra control lines for the 8048 and the 5 MHz clock signal are not used in our case.
All other I/O lines are used internally for I²C bus, control of the reference switch and SB-Bus interface. The TP signal was extensively used during development of the software but has no real use any more now the project is finished. You can still measure a frequency of approximately 500Hz on it, giving some indication about the inaccuracy of the software timed gate time.
Originally the PM-6668 has an optional reference input connector mounted at the rear panel.
But in order to use that you'll have to open the instrument and relocate a small jumper.
This is not really convenient if you ask me.
So if you are interested in using the external input you can add one extra IC to the processor board to make an electronic selection between the internal and external reference signal.
A fast TTL quad NAND IC will take care of the source selection. It's the operator's responsibility to apply an accurate reference signal of 10.000000MHz at TTL level to the reference input when the external reference is selected.
|27C256||1||Programmed with software|
|74AHC00||1||Other high speed Nand gates are also possible|
|Capacitor 100nF||5||Put close to every IC|
|4 way mini-DIN connector||1|
|Socket 28 pin||1||Twisted contacts!|
|Socket 8 pin||1|
|20 pin boxed header||2|
|20 way connector||2|
|20 way flat cable||2||About 10cm long each|
I realize now that the SDA30C163 may be hard to get, although I've seen them on Ebay.
This project was created before I even considered publishing any of my work on the internet.
Therefore I went for a suitable processor which was at hand at the time.
Perhaps it would have been better if had chosen a more common processor though.
But I have found a solution for those of you who really want to build this project.