I mentioned the Mega8, there might ne AVRs with more IO lines.
You wire the data pins to your relays, or relay drivers. I would rob one of them to communicate with the chip. Lets say there are 23 I/O pins, wire 22, and one will be the RS232 input. Then write a program to monitor that pin in...
If you used the 74153 or 74154 you will still need logical to do the RS232, that is why I like the Mega8. It has all the IO lines on the chips and you use one for the RS232 communications.
I have done this in two different ways.
1) a Win32 app (PowerBASIC) that talks to the serial port to a PIC 1684. Send O10 that is On 10 SECONDS, and send F1 that is oFf 1 minute. PowerBASIC was used, since I telnet into a port over the internet to flip the relay on and off.
2) Simple...
There is an article on www.bastoc.com that will count between
pulses. So you square off the freq., use as AVR 2313 to count the timing between pulses, and then generate you of freq. out on another pin.. Go to bastoc.com, click RVKBASIC, and there are articles or chapters. That might help...
I would get 4 AVR Mega8 chips, 2 for input side and 2 for output (LED) side. There are, I think, 23 I/O pins. Make one TX on one pair, and other (output side) make one pin of each chip RX. Write a program to read 22 inputs, and send a bit pattern via RS232 of the input pair to the output...