8802080913:
;***************************************;所有的灯逐渐从暗到全亮,再由全亮到暗;***************************************ORG0000HSTART:MOVR0,#01H ;延时次数置初值MOVR1,#00HMOVR2,#00000000B;灯控制字置初值MOVR3,#11111111BLOOP:MOVP0,R2;从暗到亮时输出"0",亮灯;从亮到暗时输出"1",灭灯MOVA,R0;延时次数暂存于ALOOP1:MOVR4,#10;延时DJNZR4,$DJNZR0,LOOP1INCA ;延时次数递增MOVR0,AMOVP0,R3;从暗到亮时输出"1",灭灯;从亮到暗时输出"0",亮灯MOVA,R1;延时次数暂存于ALOOP2:MOVR4,#10;延时DJNZR4,$DJNZR1,LOOP2DECA ;延时次数递减MOVR1,AJNZRTN ;达到最亮或最暗时,反转灯控制字MOVA,R2CPLAMOVR2,AMOVA,R3CPLAMOVR3,ARTN:SJMPLOOPEND