The title basically states what I want, but to detail more: I have a microcontroller that has some outputs directed to a TXB0108 level shifter. Basically it's an 8-bit bidirectional level shifter that has a control port (OE) that can be used to enable/disable the 8 data ports. When OE is low, all the data pins are in high impedance. What I want to do is to set one of the outputs from the microcontroller (that goes to the TXB0108) to 0 or 1 while OE is high, and then set OE to low and have the last state of the corresponding output of the TXB0108 preserved. Any ideas?
I'll assume that by "have the last state of the corresponding output of the TXB0108 preserved" that you mean "... preserved on the non U-controller side of the TXB0108", and that only one line is involved ad that it is always the same line and that it is mono directional and outgoing from the u-controller. And that .. :-).
An adhoc one line unidirectioal "bus-holder" can be made with a non inverting buffer with a resistor from output to input OR
2 x digital inverters in series (to form a non inverting buffer) with a resistor from output to input.
Using inverters is more common as they are normally more available as part of an overall design - but with hex buffers you'd get twice as many per package. Using Schmitt triggered devices is nicer but not essential. This is essentially a level driven latch.
The first diagram below is simply a non latching inverter.
The second diagram shows a non inverting buffer with the 3M resistor providing positive feedback for latching. The 1M adds Schmitt trigger action and can be omitted when used as described. The actual value of the '3M' resistor can be set to suit the situation and logic family. Lower gives a stiffer latch to "pull against". Higher reduces power and makes toggling easier.
The third diagram shows the two inverter version. An advantage is that invered and non inverted latched outputs are available. Again, the 1M adds Schmitt action and is not needed here. The inverters can be Schmitt or non Schmitt types. (CD40106, xx74yyC14, ...)
A bidirectional version can be easily implemented subject to certain limitations. he 1M resistor is omitted and the circuit is driven at its "input". While the drive level exceeds the feedback resistor + inverter drive the input line drive dominates. When the input line goes open circuit / high impebance the lacth self hold via the "3M' resistor and the input line is "latched" by this as well. Making the resistor lower in value provides more drive. For example, if the drive circuit can easily overcome inverter drive via a 10k resistor then using a 10k provides that level of drive impedance when the input goes to high impedance.
A circuit can be design tailored to an actual need if the need is fully known and ICs to do yur task are probably available as noted by @markrages.
Above circuits from beam-wiki on Schmitt triggers
Just use a latch, for example 74HC573 (identical to 74HC373, but has better (in my opinion) pin layout).
As your OE signal is too low voltage (3.3V), you should put in additional level shifter out of two transistors, like this:
Now, when OE is high, the latch is in transparent mode (output=input). When OE goes down, latch keeps the outputs the same as they were when it was up, while TXB0108 disables its outputs. TXB0108 is connected trough Q2 instead of directly so that it gets the signal at the same time as the latch.
The datasheet specifies that TXB0108 disables the outputs in at least 14ns, while 74HC373 (573) only requires 4ns hold time (time between LE going down and inputs changing), so it should work.
The solution with inverters may not work if other component change the voltage on the TXB0108 5V output pins when they are in High-Z mode.