Discrete Logic

EDIT: There is a flaw with the XOR circuit, see More Discrete Logic.

Continuing on from Sum of Two Bits, I now need to make logic using only discrete components. Addition of one bit requires two AND gates, two XOR gates, and one OR gate.

OR Gate

OR Gate

Originally I had planned to make the OR gates using transistors, I had already ordered 500 NPN and 500 PNP from Farnell so I have plenty to spare for a while. But with my new found love of pull down resistors, I realised that using diodes I could make OR gate.

If A or B are high then Out will be high too. If neither are high, then the pull down resister will pull Out down to ground.


AND GateAND Gate

When A and B are low, voltage on the right transistor will be pulled up to high, turning it ‘on’, causing Out to be grounded.

When both A and B are high, a circuit is formed and the base of the right transistor is grounded, turning it ‘off’, allowing Out to be pulled up to high.

If only A or only B is on, a circuit to ground won’t be formed so the right transistor will remain ‘on’.


This one I used iCircuit on iOS to design. It uses two PNP transistors.

If the left switch is high and the right switch is low, the left transistor is turned ‘on’. If the right switch is on, the left transistor turn off, with a pull down resister added it can be pulled to ground.

If both switches are high, neither transistor will allow the circuit to complete.


Accelerometer next to 5mm LEDMy accelerometer arrived. It’s not a part of my Programmer Calculator, but just something to play around with. It was a lot smaller than I thought, I knew it was gonna be around 3mm, not sure I will be able to just solder some legs onto it to testing, I will probably have to make an adaptor board for it.

In the picture to the left, I’ve placed a standard 5mm LED next to it so you can see just how small it is.

From LCD to OLED

OLEDHaving finally gotten the LCD working, I’ve upgraded to an 96×64 pixel OLED (organic LED) display.

I chose DD-9664FC-2A from Farnell, since it was cheap to replace incase I broke it, and there was a separate development board I could plug it onto.

I was unable to get it to boot up initially, but after reading the datasheet a little more carefully, I found that the display requires 14V, but the logic only requires 2.5v.

The 14V can be generated from a charge pump, the SSD1331 controller chip has one, or it can use an external source. I was unable to find one on Farnell for the correct gain, so I chose to use my new 15V power station, and supply 2.5V to the PIC24 with a voltage regulator.

After accidentally short circuiting my voltage regular, I finally got the screen to turn on. However I’m starting to wonder if I broke it since there is a black band, the refresh rate is slow. I might just have it configured wrong, and the black pixels could just not be set to be on.