注意字符表未经验证, 请自行调试
#include
#define uchar unsigned char
#define uint unsigned int
const unsigned char design[16]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x40,
0x20,0x10,0x08,0x04,0x02,0x10,0x00};
void delay_1ms(uint x)
{
uint i,j;
for (j=0;j
}
void set_led(uint jiange)
{
uchar i;
for (i=0;i<16;i++);
{
P1=design[i];
delay_1ms(jiange);
}
}
void main(void)
{
uint jg_ms;
jg_ms=500;
set_led(jg_ms);
jg_ms=200;
set_led(jg_ms);
jg_ms=500;
set_led(jg_ms);
}
改下这个程序就可以了
ORG 0000H
START: LJMP MAIN
MAIN: MOV A, #0FFH
CPL ACC.0
LOOP: MOV P1, A
LCALL DELAY
RL A
LJMP LOOP
ORG 2000H
DELAY: MOV R4, #200
LOOP2: MOV R5, #248
LOOP3: DJNZ R5, LOOP3
DJNZ R4, LOOP2
RET
END
注意字符表未经验证,
请自行调试
#include
#define
uchar
unsigned
char
#define
uint
unsigned
int
const
unsigned
char
design[16]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x10,0x00};
void
delay_1ms(uint
x)
{
uint
i,j;
for
(j=0;j
(i=0;i<110;i++);
}
void
set_led(uint
jiange)
{
uchar
i;
for
(i=0;i<16;i++);
{
P1=design[i];
delay_1ms(jiange);
}
}
void
main(void)
{
uint
jg_ms;
jg_ms=500;
set_led(jg_ms);
jg_ms=200;
set_led(jg_ms);
jg_ms=500;
set_led(jg_ms);
}