The registers aren't for just turning the LEDs on or off. They are for setting the ON and OFF times of the PWM. Bit 12 of each combined value is used as a "full" setting, so:
To set the LEDs on to full brightness you need to set:
PCA9685_ALL_LED_OFF_L to 0x00
PCA9685_ALL_LED_OFF_H to 0x00
PCA9685_ALL_LED_ON_L to 0x00
PCA9685_ALL_LED_ON_H to 0x10
This sets the off time to 0 counts and the on to be "full on".
It doesn't really matter what value you set the OFF to as long as you set ON to "full on" and off isn't set to "full off".
For off you should set the ON to 0 and the OFF to "full off" (reverse the above settings).
Section 7.3.3 of the datasheet says:
The turn-on time of each LED driver output and the duty cycle of PWM can be controlled independently using the LEDn_ON and LEDn_OFF registers.
There will be two 12-bit registers per LED output. These registers will be programmed by the user. Both registers will hold a value from 0 to 4095. One 12-bit register will hold a
value for the ON time and the other 12-bit register will hold the value for the OFF time. The ON and OFF times are compared with the value of a 12-bit counter that will be running
continuously from 0000h to 0FFFh (0 to 4095 decimal).
Update on ACK requires all 4 PWM channel registers to be loaded before outputs will change on the last ACK.
The ON time, which is programmable, will be the time the LED output will be asserted and the OFF time, which is also programmable, will be the time when the LED output will be
negated. In this way, the phase shift becomes completely programmable. The resolution for the phase shift is 1⁄
4096 of the target frequency.
So you have to set all 4 registers together for anything to happen.
There are also some examples shown in the datasheet as well which explain it better.
In simple terms:
- There is a free-running counter that counts from 0 to 4095
- When the ON time matches the counter the LED turns on.
- When the OFF time matches the counter the LED turns off.
- If a channel is "FULL OFF" it will be off regardless.
- If a channel is "FULL ON" and not "FULL OFF" it will be on regardless.
- "FULL OFF" always takes priority over everything else - even "FULL ON".
Some simple examples:
- All off: ON=0x0000 OFF=0x1000
- All on full: ON=0x1000 OFF=0x0000
- 50% duty: ON=0x0000 OFF=0x0800
- 25% duty: ON=0x0000 OFF=0x0400
- 25% duty with phase shift: ON=0x0100 OFF=0x0500