这容易,程序如下:
#include
#include
#define uchar unsigned char
#define out P1
uchar code table1[]={0x7E,0x3C,0x18,0x81,0xC3,0xE7,0xFF,0xE7};
uchar j=0;
void delay(uchar ms) //延时
{
uchar j;
while(ms--)
{
for(j=0;j<250;j++)
{;}
}
}
void main()
{
out=0x00;
LOOP:
out=table1[j];
j++;
if(j>=8)j=0;
delay(200); //延时200mm
goto LOOP;
}
把8个状态放到数组里,每次取1个送到端口,就这样循环取呗。应该先学习一下单片机入门教程
最好学习单片机C语言,汇编的不好学
MAIN: MOV P1, #01111110B
ACALL DELAY
MOV P1, #00111100B
ACALL DELAY
MOV P1, #00011000B
ACALL DELAY
MOV P1, #10000001B
ACALL DELAY
MOV P1, #11000011B
ACALL DELAY
MOV P1, #11100111B
ACALL DELAY
MOV P1, #11111111B
ACALL DELAY
MOV P1, #11100111B
ACALL DELAY
JMP MAIN
DELAY:MOV R5,#250 ; 延时
D1: MOV R6,#250
D2: MOV R7,#250
D3: DJNZ R7,D3
DJNZ R6,D2
DJNZ R5,D1
RET