MH7442 BCD to Decimal Decoder

Used Products:

1. Arduino UNO
2. MH7442

Content:

General Description These BCD-to-decimal decoders consist of eight inverters and ten, four-input NAND gates. The inverters are connected in pairs to make BCD input data available for decoding by the NAND gates. Full decoding of input logic ensures that all outputs remain off for all invalid (10–15) input conditions. Features ■ Diode clamped inputs ■ Also for application as 4-line-to-16-line decoders; 3-line-to-8-line decoders ■ All outputs are high for invalid input conditions ■ Typical power dissipation 140 mW ■ Typical propagation delay 17 ns

Code:

int pins[] = {2,3,4,5}; void setup() { for (int i = 3; i > -1; i--) { pinMode(pins[i], OUTPUT); } } void loop() { for (int a = 0; a < 10; a++) { for (int i = 3; i > -1; i--) { int pin = pins[i]; if (a & (1 << i)) { digitalWrite(pin, HIGH); } else { digitalWrite(pin, LOW); } } delay(200); } }