I've Decided i'm going to write (feel free to join in or offer advice) a Series of firmwares that turns an
ATTiny45/85 (8 pin dip) into that Missing Logic Gate you need.
I'm going to be doing it in this order.
XOR - Finished (Completed)
AND
OR
NOT (Hex/Inverter)
NAND
NOR
..Please add any i missed.
http://www.kpsec.freeuk.com/gates.htm
I'm Emulating the 4000 series.
Once i've written them i'll zip them up and post them for all to use.
Meanwhile, i'll post each routine as i finish them in this thread
The code to emulate the EXOR (Exclusive or logic gate)
//Logic Attiny45/85 Emulated Gates 4XXX series.
/* Instructions
1. Upload the ISP sketch to an Arduino board.
2. Program the attiny accordingly.
3. Upload this sketch via Aruduino as ISP
*/
//Arduino Emulating a Logic EX-OR (Exclusive-OR)
//I Plan on doing a library of these, either to temp replace
//a faulty IC, or to improve on one..
//for example, No need to tie these pins down with pull up/down resistors
//add extra functionality of logic
//This Code is for an XOR (Exclusive OR)
void setup()
{
// put your setup code here, to run once:
pinMode(4,INPUT); // pin 3
pinMode(3,INPUT); //pin 2
pinMode(0,OUTPUT); //pin 5 (this is your Logic HIGH/LOW)
}
void loop()
{
boolean Status1 = digitalRead(3);
boolean Status2 = digitalRead(4);
if (Status1==Status2)
digitalWrite(0,LOW);
else
{
if ((Status1==HIGH) || (Status2==HIGH))
{
digitalWrite(0,HIGH); //Your Logic Result on Pin 5
//add a delay for example, stuff 4070 can only dream of :D...
//delay(400);
//or analogWrite, make it Fade in and Out!
}
else
digitalWrite(0,LOW);
}
}
I Hope this has not been done before, if it has here's my take on it, I'm sure there's probably much much elegant and efficient ways to do what i'm
doing right now and i'm sure people will.. but it's not exactly calculating pi to a 1k billion places or operating anything time critical, i'm merely using
Attiny85's at 1mhz or 8mhz internal oscillator.
If you find it useful, eg to replace a dead logic gate chip with one of these as a short term fix, please do.