/*
https:www.ti.com/lit/ds/symlink/txs0108e.pdf
This device is an 8-bit non-inverting level translator
that uses two separate configurable power-supply
rails. The A port tracks the VCCA pin supply voltage.
The VCCA pin accepts any supply voltage between 1.4
V and 3.6 V. The B port tracks the VCCB pin supply
voltage. The VCCB pin accepts any supply voltage
between 1.65 V and 5.5 V. Two input supply pins
allows for low Voltage bidirectional translation
between any of the 1.5 V, 1.8 V, 2.5 V, 3.3 V, and 5
V voltage nodes.
When the output-enable (OE) input is low, all outputs
are placed in the high-impedance (Hi-Z) state.
*/
void setup()
{
Serial.begin(115200);
pinMode(7, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
}
void loop()
{
delay(1000);
float Vcca = 5 * (analogRead(A0) / 1024.0);
float Vccb = 5 * (analogRead(A1) / 1024.0);
Serial.print("Vcca: ");
Serial.print(Vcca);
Serial.print(", ");
Serial.print("Vccb: ");
Serial.print(Vccb);
Serial.println();
Serial.println();
for (int i = 1; i < 9; ++i)
{
char* delim = i == 8 ? " " : ", ";
float volts = 5 * (analogRead(A2) / 1024.0);
Serial.print("A");
Serial.print(i);
Serial.print(": ");
Serial.print(volts);
Serial.print(delim);
digitalWrite(7, HIGH);
delay(1);
digitalWrite(7, LOW);
delay(50);
}
Serial.println();
for (int i = 1; i < 9; ++i)
{
char* delim = i == 8 ? " " : ", ";
float volts = 5 * (analogRead(A2) / 1024.0);
Serial.print("B");
Serial.print(i);
Serial.print(": ");
Serial.print(volts);
Serial.print(delim);
digitalWrite(7, HIGH);
delay(1);
digitalWrite(7, LOW);
delay(50);
}
Serial.println();
Serial.println();
delay(4000);
}
TXS0108E A8
TXS0108E OE
TXS0108E B5