Zolatron 64: More adventures in level shifting

In a previous post, I detailed how I’m having to shift voltage levels on signals running between a 65C22 VIA chip and the GPIO pins of a Raspberry Pi.


The solution I settled on was to go for simple voltage dividers using pairs of resistors. And that’s been working fine.

I mean, you’d expect it to work with the 5V signals coming from the VIA and going to the Pi’s 3.3V GPIOs. But I also used it for signals travelling the other way. It’s not necessary, but it does protect the Raspberry Pi should the VIA put out any 5V signals on its ports while powering up.

As for the eight-bit data bus, that has to work in both directions, so the resistor divider approach seemed the best way.


You need two resistors for each signal. With 16 signal lines, that was starting to look like an awful lot of resistors.

Simple translation

As explained in the previous post, I’d tried various level shifting ICs, which didn’t work out too well. Then I found another.

The 74LVC4245 is an eight-bit level translator. Like the TXB0108 which I’d tried earlier, it’s bidirectional. Unlike the TXB0108, it doesn’t change direction automatically.

It’s simplicity itself to use. You run your 5V signals to eight pins on the A port and the 3.3V signals to corresponding pins on the B port. You connect one pin to 5V for power and two others to a 3.3V supply (I’m using an LM1117 regulator to get that). There are three GND pins and an output enable (/OE) that I’ve just tied to ground.

That leaves one pin, labelled DIR. You feed a high or low signal to this to determine whether the 3.3V pins follow the state of the 5V ones, or vice versa. With DIR low, the 3.3V pins are inputs and the 5V ones outputs. With DIR high, it’s the reverse.

The 74LVC4245 on its breakout board. From this angle, it appears that the chip is soldered to the board a little skew-whiff. That’s because it is. But hey, it works.

The DIR pin affects all eight channels simultaneously, but this is fine for a data bus. All I needed to do was control the DIR input with another signal from the 6522. Switching between input and output on the data bus doesn’t happen frequently or rapidly. In fact, when loading a file from the Raspberry Pi, the direction of the VIA’s data port is switched only twice.

The versions of the 74LVC4245 that I got were in 24-pin SOP format. For experimentation, I ordered some of those breakout boards that allow you to use SMD components on a breadboard.

While I was waiting for the parts to arrive, I hacked my code to enable that DIR signal pin.

The parts arrived and I got soldering. With everything wired up, I switched on, issued the LOAD command and … it worked. Just like that. No miswired pins, no software gotchas, it just worked fine. That hardly ever happens.

So two chips – the 74LVC4245 and the LM117 – save me 16 resistors. That’s a good trade.

1 thought on “Zolatron 64: More adventures in level shifting

  1. MichaelCook.tech

    That’s great. I often use those little “Logic Level Converter Bi-Directional” modules which can be convenient and tiny – handling even just one signal but your solution is much tidier for a whole bunch of them! Nice


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.