I'm currently working out on a project which requires the Arduino to trigger different "events", which are basically different pieces of electronics connected to relays.
To do so, I would like to issue 4 bits binary number on four Arduino pins, then have a circuit decoding this word and opening one out of 16 relays. This seems very close imho to a keyboard decoder, but is the exact opposite.
I can probably build a circuit out of transistors for it, but maybe there's another solution ?
Thanks,
T.
PS : I can't use 16 Arduino pins just for this, not even 8, as I don't have enough left
PS2 : Edited this post to remove a mistake the last responses refer to. I used to think a word was a half-byte, which is a complete mistake. So answers on this point have a meaning, I'm just editing this message to prevent people who won't read the entire thread to make the same error.
FWIW, if a byte is 8 bits, a word is 16 bits and 4 bits is a nibble.
--Phil.
A word is based on the architecture. It's the natural unit of data used by the computer, and for a modern PC it's 32 or 64 bits. For a Harvard architecture (such as the Arduino), it's even more confusing because the instruction word need not (and in this case is not) be the same width as the data word.
Where the ATMEGA datasheet refers to it as an 8-bit microcontroller, it means 1 data word = 8 bits.
The midrange PIC microcontrollers have a 14-bit instruction word and 8-bit data word, so you don't even need to stick to a multiple of 8 or power of 2.