cpp
#include "REG52.h"
sbit K1 = P3^2;
void main()
{
unsigned char Xd=0,ss=255;
while(1)
{
if(K1==0&&++Xd==0)
{
if(ss>128)ss=128;
else ss/=2;
if(ss==0)ss=255;
while(K1==0);
}
P1=ss;
}
}