S4165M is a wall switch brightness adjustment dedicated chip with memory function. It outputs three-segment PWM signals and is used in conjunction with a switch main control chip with a PWM control port. The internal state switching window time Tsw is set. The typical value is 6.4S. If the light-off time exceeds the state switching window time, the chip will remember the state before turning off the light. When turning on the light next time, the state before turning off the light will be directly presented. If the light-off time is less than the state switching window time and then turning on the light, brightness adjustment can be achieved, increasing the convenience of use. The chip integrates an EEPROM storage unit. The redundant design of multiple storage units ensures long-term data storage and the number of power on/off cycles. The PWM signal frequency of S4165M can be adjusted through the periphery and can be compatible with various application requirements such as isolated, non-isolated and linear. AC signals are detected to judge on/off to ensure the synchronization of switch switching states.