Posted: 05:41am 25 Feb 2015 |
Copy link to clipboard |
 Print this post |
|
after recent discussions about additional serial TxD ports on the micromite i've put together an extremely simple design using a 74HC154 to switch a single TxD output between 16 different listening devices.
the '154 is a rather old component (1972 era) originally intended for memory address decoding. a 4-bit address bus would decode to 16 outputs, with the selected output further gated with two enable inputs for deglitching purposes and expansion of the decoder.
what makes the device useful today is that the 16 outputs and 2 enable inputs are all active-low. outputs Y0 to Y15 all sit at logic '1' normally, with the selected input (via A0 to A3) only going to logic '0' if E0 and E1 are both low. this makes the device compatible with the TTL serial port convention of idling at logic '1'.
we control A0 to A3 from a convenient set of (contiguous) digital output pins on the micomite, and route the COM1: TxD line into one of the enable inputs. the other enable input is not used so tied low. the HC variant of the device, the 74HC154, will operate with a Vcc between 2v and 6v (a wider range than that of the micromite), and is capable of driving 20mA loads. if 5v outputs were required, the 74HC154 could probably be supplied from a separate 5v Vcc.
the code to use this hardware is extremely simple (a single port command selecting the 1 of 16 listening devices), and will work with both the original and Mk2 micromites, along with the maximite:
setpin 2, dout
setpin 3, dout
setpin 4, dout
setpin 5, dout
OPEN "COM1:" AS #5
for i = 0 to 15
port(2,4) = i
print #5, "this is channel Y"; i
next i
CLOSE #5
note that as unselected outputs all idle at logic '1', this design is mostly NOT compatible with configuring the serial port as inverted output (option INV).
as always, the above code is totally untested, and has not been anywhere near a micromite - it may contain small syntax errors, etc. but, in principal, i believe the method should work.
cheers,
rob :-) |