8x8x8 multiplexed LED cube with an Arduino Mega 2560

I've read about the direct port manipulation and I think I understand what it's about and I have also come to the understanding that OE means output enable. I'm still struggling to understand the following:

  1. Looking at the datasheet of the TPIC6B595, I can't find an OE pin on it. How can I set the OE on the shift register? My current understanding is that I should use two pins on the Arduino to control when and how data is transferred to the shift registers: SS and OE, instead of the currently used SS only. The SS should remain connected as it is now, but where on the shift registers is the OE pin?
  2. The direct port manipulation section of the Arduino documentation states that PORTD is mapped to pins 0-7, but they only say that it is so on ATmega8, ATmega168 and ATeega328 chips. Mine is ATmega2560. Nobody seems to write anything about which pins PORTD maps to on the Mega2560... I think I would have to disconnect the SS from the current Arduino pin 53 and connect it to where bit 2 of PORTD is mapped. I should connect the OE to where PORTD's bit 3 maps... But which pins are the bits of PORTD mapped to on my Mega2560? :slight_smile:
  3. There are a few things I'm not sure I understand in the example code:
PORTD = PORTD | B00000010; // bring OE/ high
// xfer data
    SPI.transfer (B00000000);
    SPI.transfer (B00000001); //leftmost, frontmost corner cathode column
    SPI.transfer (B00000001); //bottom anode plane
PORTD = PORTD & B11111011; // bring SS/latch low
PORTD = PORDT | B00000110;  //  bring OE/ an SS/latch high

a) PORTD = PORTD | B00000010; //bring OE HIGH
Didn't you mean to bring EO low here (in the beginning, before the SPI transfers)? Isn't the goal to disable the outputs during the next lines, which do the transfer?
b) PORTD = PORTD & B11111011;
PORTD = PORTD | B00000110;
There's nothing in between bringing the SS/latch LOW and bringing it back HIGH. Is that correct and is that so in order to keep the time between the point when the data transfer starts and the data transfer ends to a minimum?

Thank you!