/*
See https://blog.jochumzen.com/ entry 17
Demonstration: 4 line to 16 line decoder.
Set DIP 1 to ON (Enables the decoder)
Set DIP 5-8 to anything, observe the LED's
Example, if DIP 5-8 is set to 0110 (decimal 6), then the LED 6 (the seventh from left) turns on.
If DIP 1 is OFF, no LED is on.
*/
//Library with basic gates
#include <ACELBC.h>
//Create an Arduino board
auto* ard = new ArduinoBoard();
//Define chips
auto* decoder = new Decoder4To16();
//Add all chips to be emulated here
Chip* chips[] = {
decoder
};
//Add all connections here
ConnectionBase* connections[] = {
new ConnectionFour(ard, 2, decoder->D, 1), //2,3,4,5 to D3, D2, D1, D0
new Connection(ard, 6, decoder->E),
new ConnectionSixteen(decoder->Q, ard, 22, 0), //Q0 to 22..Q15 to 37
};
//Setting up the emulation. No need to change
Emulation emulation = Emulation(ard, chips, sizeof(chips)/2,
connections, sizeof(connections)/2);
void setup() {
Serial.begin(9600); Serial.println(); Serial.println("START");
Serial.println();
emulation.makePrintPin(13, 1);
//emulation.printOnArdEvent(1);
}
void loop() {
emulation.emulate();
}
Print
Address
E
0
15