Hardware

As my goal only to demonstrate different approaches I connected to LEDs only 4 out of 8 outputs of 74HC595.

It seems different datasheets have different pin names for 74HC595, so here attached pinout from datasheet.

74HC595 constant connections:
GND (pin 8) to ground,
Vcc (pin 16) to 5V
OE (pin 13) to ground,
SRCLR (MR) (pin 10) to 5V,
1k resistors and 3mm LEDs

Step 2: Simple Approach

https://cdn.instructables.com/FA1/OZDV/J1GOVDBV/FA1OZDVJ1GOVDBV.LARGE.jpg?auto=webp&fit=bounds

Protected Area

This content is password-protected. Please verify with a password to unlock the content.

Using Inline Assembly Code

Protected Area

This content is password-protected. Please verify with a password to unlock the content.

Here attached a sketch so to write 8 bits in just 2.8 microseconds. It is 32 times faster than simple approach.

Protected Area

This content is password-protected. Please verify with a password to unlock the content.

End Of Post