CD4070 - Quad 2-Input Exclusive-OR (XOR) Gate IC Documentation
The CD4070 is a quad 2-input Exclusive-OR (XOR) gate integrated circuit (IC) designed for use in digital electronic circuits. Each gate performs a logical XOR operation on two input signals, producing an output signal that is high only when the input signals are different.
The CD4070 IC has 14 pins, with the following assignments:
| Pin | Function |
| --- | --- |
| 1, 2, 3, 4 | Input 1 (A) |
| 5, 6, 7, 8 | Input 2 (B) |
| 9, 10, 11, 12 | Output (Y) |
| 13 | VCC (Positive Supply Voltage) |
| 14 | GND (Ground) |
Supply Voltage (VCC): 3V to 15V
Operating Temperature: -55C to 125C
| A | B | Y |
| --- | --- | --- |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Example Circuits and Code
Example 1: Simple XOR Gate
In this example, we use the CD4070 to implement a simple XOR gate. We connect two switches to the input pins of one of the XOR gates, and an LED to the output pin.
```
+-----------+
| |
| Switch 1 |
| (A) |
+-----------+
|
|
v
+-----------+
| |
| CD4070 |
| (XOR Gate) |
+-----------+
|
|
v
+-----------+
| |
| Switch 2 |
| (B) |
+-----------+
|
|
v
+-----------+
| |
| LED (Y) |
| |
+-----------+
|
|
v
+-----------+
| |
| GND |
| |
+-----------+
```
Code (Arduino):
```c
const int xorInput1 = 2; // Switch 1 connected to digital pin 2
const int xorInput2 = 3; // Switch 2 connected to digital pin 3
const int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(xorInput1, INPUT);
pinMode(xorInput2, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int xorOutput = (digitalRead(xorInput1) ^ digitalRead(xorInput2));
digitalWrite(ledPin, xorOutput);
delay(50);
}
```
Example 2: Half Adder using XOR Gates
In this example, we use two XOR gates from the CD4070 to implement a half adder. The half adder takes two binary inputs, A and B, and produces two outputs, Sum and Carry.
```
+-----------+
| |
| A (Input) |
+-----------+
|
|
v
+-----------+
| |
| CD4070 |
| (XOR Gate 1) |
+-----------+
|
|
v
+-----------+
| |
| B (Input) |
+-----------+
|
|
v
+-----------+
| |
| CD4070 |
| (XOR Gate 2) |
+-----------+
|
|
v
+-----------+
| |
| Sum (Output) |
+-----------+
|
|
v
+-----------+
| |
| Carry (Output) |
+-----------+
|
|
v
+-----------+
| |
| GND |
| |
+-----------+
```
Code (Verilog):
```verilog
module half_adder(A, B, Sum, Carry);
input A, B;
output Sum, Carry;
XOR Gate1(X, A, B);
XOR Gate2(Y, A, B);
AND Gate3(Carry, A, B);
OR Gate4(Sum, X, Y);
endmodule
```
Note: The above examples are just a representation of how the CD4070 can be used in various contexts. The actual implementation may vary depending on the specific requirements and application.