-
"Named" Monadic Gates
06/27/2015 at 18:11 • 0 commentsSo the monadic gates are done, but what does that give us? First, it gives us 12 "named" gates. These are gates that are useful by themselves for specific purposes and their names reflect those purposes. The remainder have no commonly acknowledged purposes of their own, but can serve as building blocks for other more complex gates. Of course I use "commonly acknowledged" very loosely since there are so few actual implementations of ternary logic. I'll briefly describe the use of the named gates. Most of this data is derived from the work of Douglas W. Jones.
Named Monadic Gates:
P (-0+): The buffer/driver. The output is identical to the input.
5 (+0-): The "simple" ternary inverter, or STI. This is used to reverse the input given. If the input is -, the output is + and vice versa. The 0 is it's own complement and remains unchanged.
2 (+--): Usually referred to as the negative ternary inverter, or NTI. It is the same as the simple ternary inverter but the 0 changes to a -. In an unbalanced ternary system (where all three logic states are at or above 0V) this can be used as one of two ternary to binary converters because it's output is two-valued and, in an unbalanced system, the + and - values could be designed to correspond to the 1 and 0 values of a binary system. Additionally, this gate serves as the "Is False" function. It outputs a + only when the input is a -.
8 (++-): The positive ternary inverter, or PTI. The same as the simple ternary inverter but the 0 changes to a +. In an unbalanced ternary system this is one of the two ternary to binary converters.
6 (-+-): The "Is Unknown" gate. It outputs a + only when the input is a 0.
K (--+): The "Is False" gate. It outputs a + only when the input is a -.
7 (0+-): Increment. The output is an increment of the input.
B (+-0): Decrement. The output is a decrement of the input.
C (-00): Clamp Down. Changes the range from - to + into - to 0. Useful for ternary to binary conversions in a balanced ternary system.
R (00+): Clamp Up. Changes the range from - to + into 0 to +. Also useful for ternary to binary conversions in a balanced ternary system.
That does it for the monadic ternary gates. Next I'll compile a final set of diagrams for the LM319 implementations. -
Monadic Gates Completed
06/26/2015 at 17:14 • 0 commentsI've worked out the last two monadic gates (7 and F) using the LM319. In both cases it requires the use of three gates meaning two separate 319's. That makes these two the most complicated of the monadic gates (though still very simple). Here's the diagram.
-
Monadic Gates, Take 4
06/24/2015 at 17:15 • 0 commentsI've revised the A,N, and T monadic gates to simplify them and reduce them to a single LM319. Here's the diagram.
This leaves only 2 more monadic gates to go and I think I've got those under control. Then I can move on to 2-input gates like AND, OR, NAND, NOR, XOR, etc.
-
Monadic Gates, Take 3
06/23/2015 at 16:24 • 2 commentsFour more monadic gates down. By taking two existing gates and using diodes off of their outputs, I can arrange four more gates; 5, B, M, and P. This is because, with the diodes protecting the return path to the LM319's, the resulting output is always the greater output of the two different gates. Here's the diagram. [Edit - 5 and P were screwed up here, diagrams in later project logs have them marked correctly].
I had actually worked out a method to produce gates A, N, and T as well, but it required the use of two LM319's. By using the above technique with diodes, I am sure I can simplfy them to only use a single 319. Here is the existing, more complicated diagram. I'll submit a revised one once I've tested out the idea.
Once I've worked out all monadic gates I'll post a single comprehensive diagram giving each one in order. -
Monadic Gates, Take 2
06/18/2015 at 06:04 • 0 commentsThree more monadic gates down. The LM319 can implement the monadic gates 3,6 and G by way of window comparators. A window comparator (or window detector) uses two comparators to define an upper and lower limit. If the voltage is in between those two limits then the output is activated. Here's the diagram.
-
Missing Vital Data
06/17/2015 at 07:26 • 0 commentsOops! I forgot to mention one of the most key datums that make this whole project possible. Since I'm using comparators... what am I comparing the incoming signal to? Well, in any logic system you need to define what range of voltages define the various states. This is called the logic family.
In the ternary logic family I've developed for testing there are five different voltages that are used to delineate the three states. The power supply provides a -5V rail, a 0V ground, and a +5V rail. From the -5V rail I use two resistors to create an approximately -1V rail and on the +5 side I do the same to create an approximately 1V rail.
The - state is -5V to -1V
The 0 state is -1V to 1V
The + state is 1V to 5V
Example: If I want to implement the monadic operation "R" (00+), I hook up a comparator from the LM319 with ground connected to 0V to set the low signal to 0 and then attach the output to 5V to set the high signal. Then I attach the negative input of the comparator to 1V. If the incoming signal to the positive input of the comparator is greater than 1V (i.e. it's 5V) then the output is + (5V). If the incoming signal is less than 1V (i.e. it's -5V or 0V), then the output is 0 (0V).
This was all in the diagrams linked to in the post "Monadic Gates, Take 1", but with no explanation.
-
Another look at the LM319
06/16/2015 at 06:31 • 0 commentsIt looks like I spoke too soon. The 319 is actually more versatile than I thought. It has an interesting arrangement for power management in that it has a Vcc connection (to +5V), a Vee connection (yep, that's for the negative voltage, -5V), and a separate ground connection for each of the two comparators on the chip. I had initially connected the ground connections to ground (duh!) but just found that I can connect them to -5V as well. When in this mode, the "low" signal is now -5V instead of 0V. Further, when in this mode, I can now connect the open collector output to 0V reliably and the high signal becomes 0V instead of 5V. All of the sudden the LM319 looks like it can do everything the 393 could do and then some. Here is the enumeration:
With the ground pin attached to 0V, the 319 can provide these ternary monadic functions with a single comparator: E, H, R, and X.
With the ground pin attached to -5V, the 319 can provide these ternary monadic functions with a single comparator: 1,2,4,8,9,C,K, and V. These are hooked up exactly the same way as the diagram supplied for the 393.
When you take into account the three trivial functions (0,D, and Z) that are merely connections to the appropriate power rail, the LM319 can provide 15 of the 27 possible monadic functions with only one of its two comparators.
Adding to the awesomeness, the two comparators in the package have their own separate GND connections which means they can each be arranged separately for even more versatility.
-
Monadic Gates, Take 1
06/15/2015 at 07:29 • 0 commentsThe simplest gates are those which only take one input have only one output. Monadic gates are important building blocks to more complex/useful gates, but they can be useful by themselves in some circumstances. In binary there are only 4 of these (2^2 = 4) but in ternary systems there are 27 (3^3 = 27). Much of what I am trying to demonstrate is described in Dr. Douglas W. Jones' description of ternary logic and I use his naming conventions.
Binary monadic gates:
Buffer/Driver
In Out 0 0 1 1 Inverter
In Out 0 1 1 0 Constant 0 (not really useful, but here for completeness)
In Out 0 0 1 0 Constant 1 (not really useful, but here for completeness)
In Out 0 1 1 1 Ternary monadic gates
0 1 2 3 4 5 6 7 8 9 A B C D E F G H K M N P R T V X Z - - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + 0 - - - 0 0 0 + + + - - - 0 0 0 + + + - - - 0 0 0 + + + + - - - - - - - - - 0 0 0 0 0 0 0 0 0 + + + + + + + + + (The labels in the top row are names for a series of three trits. Just like hexadecimal is just a naming scheme for series of 4 bits. This system is called heptavintimal - base 27)
The goal is to test the two devices I am using (a Fairchild Semiconductor LM319 dual comparator and a Motorola LM393 dual comparator) and see which monadic operations they can produce. Three of the operations (0, D, and Z) are trivial because they are always -, 0, or +. That is equivalent to just attaching the signal to the appropriate -5V, GND, or +5V rail. That leaves only 24 monadic operations to work out.
The comparators have a - input and a + input. If the + input is greater than the - input then the output line allows current to flow through it to ground. The LM393 allowed me to use both the +5V and the GND lines on the output pin but the LM319 only allowed me to use +5V. That made the LM393 more versatile, but the LM319 handled low signals differently. Low signals on the LM319 returned GND while the LM393 returned -5V for it's low signal. The result is that both devices would produce a subset of the monadic operations, but each was a different subset. Together they took care of 12 possible combinations. Add that to the 3 trivial operations and there are 15 out of 27 monadic operations accounted for using just the power rails, or only a single comparator.
The LM393 can produce the following monadic operations: 1,2,4,8,9,C,K, and V. Diagram
The LM319 can produce the following monadic operations: E,H,R, and X. Diagram
If you look carefully you'll notice the pattern that each monadic operation we can produce is a pattern of 2 outputs that are the same and one that is different. Also, the one that is different is alway the top or bottom one, never the middle. This is a consequence of how a comparator always chooses the greater of two inputs to make it's decision as to whether or not to output. Hopefully, by chaining together the monadic gates now possible I can make the remaining ones.
-
Ternary Prequel
06/14/2015 at 05:46 • 0 commentsBefore I begin, this first log will cover what I tried earlier, why that failed, and how that led me to choose comparators as the tool-of-choice.
Initially I planned on using transistors, but the parts count would be far too high. Two factors play into this. First, that ternary gates are more complicated (in most cases) than binary gates, thus requiring more transistors. Second, that the binary gate examples you usually see on the internet are rather naive. You might see an example showing only two FETs being used to implement a binary inverter, but if you check the datasheet for an actual part, you'll probably see two transistors, a resistor, and five diodes per gate (actual example: CD4049B). That's what it takes to make a reliable gate. In addition to all that, transistors have a property wherein they only switch if the voltage applied is greater than their threshold voltage. The threshold voltage is determined by the chemistry of the silicon itself and cannot be altered. Unfortunately transistors nowadays are mostly built with threshold voltages that coincide with binary voltage levels. You almost can't find any with distinctly different thresholds unless you go to expensive power MOSFETS intended for switching high current loads or automotive transistors. In both cases the threshold voltages are way higher than the usual binary digital threshold voltages so your circuit would have all sorts of voltages, and all your components would have to be capable of handling the highest one used. I'm sure if someone searched long enough (or just plain knew more about it than I do) they could find appropriate parts, but it would still take up too much board space.
Next I looked at Op Amps because they do the job of comparing one voltage to another and producing an output based on the difference. That fits nicely with what I'm trying to accomplish; detect the value of different voltage levels and behave accordingly. However, Op Amps are not ideal for this purpose because each amplifier needs to have it's feedback, hysteresis, and sometimes output voltage controlled with external resistors. This adds complication and means that one op amp might not behave exactly the same as another. Again, I don't want to spend any more time than necessary debugging analog problems.
Finally I settled on Comparators. They are basically specialized Op Amps with built-in hysteresis that don't require external feedback. This cuts out two resistors right away and ensures consistent behaviour. However, most comparators have open drain outputs, which does require a resistor. The upside of this is flexibility. If a single device has four comparators in it, each comparator can output a different voltage level, not just the VCC level. This can dramatically reduce the parts count for more complex gates. Unfortunately, comparators suffer from a condition that doesn't affect Op Amps nearly as much. This is limits to common mode input voltage. Your common mode input voltage is the sum of the voltages applied to each input divided by 2. If the resulting number is too close to VCC, then the comparator could do just about anything. If you are comparing 5V against 4V (common mode = 4.5V) and the device is powered by 5V with a common mode limit of VCC minus 1.5V (3.5V in this example) then the output can't be relied on to be correct.
For this reason, I have decided to use a dual-supply power system. That means a +5V rail, a -5V rail, and a common ground. Most comparators are okay with using +/- instead of +/GND so it isn't a problem, it's just a little weird for those of us who don't have a lot of experience with analog components. The benefit of using a dual-supply is that you are usually comparing a positive voltage against a negative voltage so the common mode is pretty close to 0V and the comparator won't do weird things.