请各位大虾帮帮忙,想让74hc595去实现这个功能:#include "stc12c5410.h"
#define uchar unsigned char
#define uint unsigned int
#define CAT=p1_5;
#define STB=p1_6;
#define CLK=p1_7;
//将I/O口的值存放在数组中,依次往外送即可。可以自定义任意花样哦。
uchar code tab[] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f, //单个依次点亮
0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff, //单个依次熄灭
0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00, //逐个点亮,前面的不熄灭
0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};//逐个熄灭
void delay(uint a)
{
uint b;
for(b=0;b
}
void main()
{
uchar a;
while(1)
{
for(a=0;a<32;a++)
{
P1=tab[a]; //依次调用数组值,送P1口。
delay(30000); //延时0.5秒
}
}
}
但上面这个程序只可以让单片机工作,并不能驱动595工作,我的目的是想让程序驱动595来实现上述功能,请工程师们帮帮我。很感激
|