Output from PortB & PortD at the same time on Uno r3

My project involves writing 11 bits of digital data at exactly the same time. PortD is 8 bits and PortB is the remaining 3 bits. Any suggestions how I can get PortB and PortD to output their data simultaneously?

Why simultaneously?? On the Casio keyboard there is a 12-conductor ribbon going from the keys to the tone generating circuits. Pins 1 - 4 are 'bank' selectors and 5 - 12 are tone generating. Tones are generated by connecting one of the bank selectors (1 - 4) to one of the tone generators (5 - 12). For example, pressing a "C" on a remote keyboard connects pin 1 to pin 12 inside the main keyboard which plays the "C". I'm using tri-state drivers to make the connection between the bank selector and the tone generator pins with the 'notes' received from the remote keyboard providing the 'trigger' or 'gate'.

Why go to the trouble?? The Casio has a feature where a major chord can be played by hitting the single-note root of the chord. My grand-nephew has a withered right hand. With a 'rigged' prosthesis he will be able to play the chord root on the remote keyboard with his right hand and play the rest of the notes with his left hand. And won't he enjoy that? :grin:

For truly simultaneous, you will have to preload an external shift register as multiple instructions (74HC595 for example), and then use shared latch pin to move output from incoming shift register to the output latch.

digitalWrite (latchPin, LOW);
SPI.transfer(lowBits);  // two 74HC595 with daisy chained data line
SPI.transfer(highBits);
digitalWrite (latchPin, HIGH);  //latchPin updates all 16 outputs at same time

How exactly? a fraction of a microsecond is achievable with:

  PORTB = bval ;
  PORTD = dval ;

for instance if bval and dval are byte variables (I've measured it as 63ns, one clock cycle)

noInterrupts();
PORTB = bval ;
PORTD = dval ;
interrupts();

bval and dval must be local / automatic uint8_t or byte variables.

Do you have any datasheets or documentation you can link to? I think you and get away with simple writes to the port or even indviduale writes (digitalWrite(pin,high/low)) to the pins.

Mark