ORG 00H
LOOP: MOV A, #0F8H ;赋初值.
MOV R2, #8 ;设计数值.
OUTPUT:
MOV R3, #4 ;设计数值.
OUT_5:
MOV P1, A ;送P1口输出.
ACALL DELAY
MOV P1, #0FFH
ACALL DELAY
DJNZ R3, OUT_5
RL A
DJNZ R2,OUTPUT
LJMP LOOP
DELAY: MOV R6, #0 ;延时子程序.
MOV R7, #0
DELAYLOOP:
DJNZ R6, DELAYLOOP
DJNZ R7, DELAYLOOP
RET
END
#include
unsigned int i=0,j,n,k;
void main()
{ while(1)
{
for(n=0x07,,j=0;j<=4;j++)
{ for(k=0;k<3;k++)
{ P1=~n;
for(i=0;i<30000;i++);
P1=0xff;
for(i=0;i<30000;i++); }
n<<=1;
}
}
}
led阴极接io口