📄 led_car.c
字号:
// Target : 8515
// Crystal: 8.0000Mhz
//最后更新:2003.03.15
#include <io8515v.h>
#include <macros.h>
#include <sl3010.c>
static unsigned char led_data[]=
{//设置LED广告灯数据表
0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,
0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,
0x00,0x18,0x3c,0x7e,0xff,0x7e,0x3c,0x18,
0x00,0x18,0x3c,0x7e,0xff,0x7e,0x3c,0x18,
0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x8f,0xc7,0xe3,0xf1,
0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x8f,0xc7,0xe3,0xf1,
0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,
0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,
0xff,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,
0xff,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,
0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,
0x0a,0x0a
};
unsigned char pa,timers;
unsigned int led_delayms=600;
//定义为字符型变量
void led_car(void)
{
port_init(); //PA,PB,PC,PD 初始化
work_status = 0x40;//置对应的工作状态标志
mic_startup(); //等待声控启动
while (1)
{
pa = 0x00;
for(timers=0;timers<4;timers++)
{//8 LED 整体亮灭闪烁
PORTA=pa;
delay_ms(led_delayms*2);
pa=~pa;
}
pa = 0x01;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa<<1;
}
pa = 0x80;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa>>1;
}
pa = 0x01;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa|(pa<<1);
}
pa = 0x7f;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa & (pa>>1);
}
pa = 0x80;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa|(pa>>1);
}
pa = 0xfe;
for(timers=0;timers<8;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa & (pa<<1);
}
pa = 0x03;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa<<2;
}
pa = 0xc0;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa>>2;
}
pa = 0x03;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa | (pa<<2);
}
pa = 0x3f;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa & (pa>>2);
}
pa = 0xc0;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa | (pa>>2);
}
pa = 0xfc;
for(timers=0;timers<4;timers++)
{
PORTA=~pa;
delay_ms(led_delayms/2);
pa=pa & (pa<<2);
}
for(timers=0;;timers++)
{
pa = led_data[timers];
if(pa == 0x0a){break;}
PORTA = pa;
delay_ms(led_delayms/2);
}
pa = 0x55;
for(timers=0;timers<16;timers++)
{//8 LED 流水灯
PORTA=pa;
delay_ms(led_delayms);
pa=~pa;
}
led_delayms = led_delayms - 100;
if(led_delayms == 100)
{
led_delayms = 600;
}
}
}
void main()
{
led_car();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -