📜 ⬆️ ⬇️

Count to three: three

Threefold counter


So, we continue the conversation. In this article I will tell you how to make a ternary counter. I remind you that I want to make the simplest, but programmable piece of hardware that works on the ternary logic. The answer to the question "why?" Look here .

This is the third article, as soon as it is ready, it will be continued. Table of contents:


As usual, in my articles there are more pictures than text. Here is the main piece of hardware, which will be discussed today:
')


Summary of the previous series


Threefold multiplexer


I remind you that the only element used in the whole structure will be a ternary multiplexer, which, in fact, is a three-position switch. Logically, this is a five-pin thing: one of them (sel) receives the three-way selector signal, and, depending on it, one of the three input signals inN, inO or inP is output to the multiplexer (out):



This is how the board looks like which carries two (de-) multiplexers on itself. Following the original name , I will call it the word Trimux.



If the multiplexer is simply connected as a repeater, supplying -5V, 0V, + 5V to the legs N, O, P, respectively, then when applying to the input S of the triangle at output C there will be a stepped signal:



Today I will use only two things: a half adder and a memory cell.



Semi-adder


In the first article, we detailed the work of the half-adder. On the layout it looks like this:



The top layout is directly a half adder, and the bottom one is an I / O board. Since I would need a fair amount of half-adders, and each time I would need to assemble a separate dummy too time consuming, I decided to make a separate half-adder board. Here is what the diluted board looks like:



This is already made:



Three trims will be inserted into this board. This is not a departure from my intention to use exclusively multiplexers as a building block, since in fact I only have wires on the auxiliary board, which save me time. Even the resistors I have are only as a paranoid current limit, they can be safely thrown out. Calculations are still engaged in trims. Here I am testing the work of the half-adder, the I / O board has also outgrown the layout:



Well, here are the modules of half-adders that are ready for operation:





Trinity memory


In the second article, we dealt with the fact that on one trimmix (on two three-way multiplexers), you can make a memory cell (a three-way latch) with memorization by level. Well, if you collect two ternary latches in the master and slave, you can get a memory cell with dynamic control, which is triggered on the front of the clock signal (ternary master-slave flip-flap-flop).

Moreover, in the comments to the previous article, the respected mayorovp proposed a variant that uses only four multiplexers. I promised to try it and try it!
Here is his proposal, which I have customized for my needs:



This cell remembers the output Q value applied to the input A, when the input of the clock signal makes two consecutive steps NO, OP.

Exactly as with a half-adder, I decided to make a separate memory block, here is a divorced board:



She bears on herself two separate ternary latches, triggered by level. If we install four jumpers, we get the above-described dynamic memory cell.

This is what a handkerchief looks like:



Well, here is the finished module:





The simplest ternary counter


So we can abstract ourselves slightly from the multiplexer itself and use higher-level blocks. Let's take three memory cells and three half-adders. This is enough to create a simple three-way counter.

In total, we have six ready blocks that can be put together like this:



The termination ramp is fed to the clock input. In fact, a memory cell plus a half adder gives the simplest frequency divider. If instead of the red one, you submit a minus one, then the counter will subtract. This is how our counter on the layout looks like, the three left LEDs on the I / O board show the status of three memory cells, the rightmost switch is used for manual clocking of the counter:



And here is a video where I simply click through all 27 possible states of our counter:



Among the shortcomings of this counter, it can be noted that when it is turned on, its state is not very well defined (in practice, after a long shutdown, it will be in the zero state). Yes, and reset this counter is nontrivial. At least I have not found an easy way.



Let's complicate


So, it works not badly, thanks a lot to mayorovp for the suggested memory option. If you go back to the previous article, I used two more multiplexers to create a dynamic memory cell than suggested by mayorovp . Let's try with them:



This counter works exactly the same as the previous one, but has two more multiplexers. What for? Because I so want! Please note that the inputs Bm and As (I painted them gray) are not used in this scheme. The clock signal on the master latch is never positive, and on the slave is never negative.

And now let's add two more multiplexers to the circuit:



If the incoming signal R is equal to minus one, then the counter is absolutely equivalent to the previous one. But what happens if it is zero or positive? The latches will remember what is applied to the inputs Bm and As!

We received a ternary counter, which can count in both directions, and the value of which can be rewritten if necessary, by applying the necessary number to the latches and resetting the signal R. Here is a video with a detailed description of the work:



So, with the help of thirty-four multiplexers (seventeen trimux), a fully functional ternary counter is assembled. Its digit capacity can be finished to the required one by adding one memory block and one half adder per trit.

Look at how Alexander Shabarshin suggests making a minute counter in ternary hours (or seconds, hours, the scheme is the same):



At one o'clock sixty minutes, so we have to use four tritas. Four tritas can store 81 different values, but in a balanced ternary system, they represent values ​​from -40 to 40. So, how can we represent, for example, 45 minutes? Alexander very ingeniously suggests saying that now is not 45 minutes, but at fifteen o'clock! The five multiplexers at the bottom right of the circuit just reset the minute counter after an hour.

For today everything, next time we will try to calculate something.

Bonus: food


Brief description of the manufacture of BP
When I wrote the first two articles, in order to get bipolar power, I used the simplest resistor divider, which was mercilessly heated. Since I had to make a triangle generator, which also requires bipolar power, but already ± 12 V, then I decided that two LATRs in one circuit are already overkill and skolhozil BP. I ordered ready-made power modules in China, put together:



I do not know why, but for some reason before the power supply unit I inserted a power filter. Since here we are talking about 230 volts, the casing is required, picked up a 3mm thick PVC sheet, bent on a nichrome wire:



Got something like this:



Here is the open power supply:



And so ready to use:



The total cost did not count, but would roughly estimate the bucks at thirty.

Source: https://habr.com/ru/post/328162/


All Articles