381
50% brightness button, X3 is ON when
pressed.
75% brightness button, X4 is ON when
pressed.
100% brightness button, X5 is ON when
pressed.
Program:
Program explanation:
1. HD0 will control the LED voltage. The voltage = 24*HD0/65535, pulse output frequency
is 100Hz.
2. Press start button, X0 is ON, M0, M1 is ON, the LED brightness adjustment starts.
3. X2 is ON, HD0=16383, HD0/32768=0.25, the LED brightness is 25%.
4. X3 is ON, HD0=32767, HD0/32768=0.5, the LED brightness is 50%.
5. X4 is ON, HD0=49151, HD0/32768=0.75, the LED brightness is 75%.
6. X5 is ON, HD0=65535, HD0/32768=1, the LED brightness is 100%.
7. Press shut down button, X1 is ON, HD0 is reset, shut down the PWM trigger condition,
LED voltage is 0V.
tudonghoatoancau.com