1、#define uint unsigned int#define uchar unsigned charuchar code table=0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00; / 逐个点亮07uchar code table1=0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00; / 逐个点亮70uchar code table2=0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff; / 逐个灭07uchar code table3=0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0
2、xfe,0xff; / 逐个灭70/*/void delay(uint t); /延时void zg(uint t,uchar a);/两边逐个亮void qs(uint t,uchar a);/全部闪烁void zgxh(uint t,uchar a); / 逆时针逐个点亮/void zgxh1(uint t,uchar a); / 顺时针逐个点亮void djs(uint t,uchar a); /对角闪void lbzgm(uint t,uchar a);/两边逐个灭/void sszgm(uint t,uchar a); / 顺时针逐个灭void nszgm(uint t,uchar
3、a); / 逆时针逐个灭void sztl(uint t,uchar a);/顺时逐个同步亮void nztl(uint t,uchar a);/逆时逐个同步亮void sztm(uint t,uchar a);/顺时逐个同步灭void nztm(uint t,uchar a);/逆时逐个同步灭void hwzjl(uint t,uchar a); /横往中间亮void hwzjm(uint t,uchar a); /横往中间灭/void swzjl(uint t,uchar a); /竖往中间亮/void swzjm(uint t,uchar a); /竖往中间灭void nzdl(uint
4、 t,uchar a); /逆时逐段亮void nzdgl(uint t,uchar a); /逆时逐段一个点亮void jgs(uint t,uchar a); /间隔闪/*/void zg(uint t,uchar a)/两边逐个亮 uchar i,j; for(j=0;ja;j+) P0=P1=P2=P3=0xff; P0=0x7f;delay(t); for(i=0;i1;i-) P1=tablei-1;P3=table1i-2; P1=0xfe;P3=0xff; P1=0xff;P2=0x01; P0=table1i-1; P2=table1i-2;P2=0xff; P0=0xff;
5、void sztl(uint t,uchar a)/顺时逐个同步亮 P1=P2=P3=table1i;void nztl(uint t,uchar a)/逆时逐个同步亮 P1=P2=P3=tablei;void sztm(uint t,uchar a)/顺时逐个同步灭 P1=P2=P3=table3i;void nztm(uint t,uchar a)/逆时逐个同步灭 P1=P2=P3=table2i;void hwzjl(uint t,uchar a) /横往中间亮 P0=P2=P1=table1i;void hwzjm(uint t,uchar a) /横往中间灭 P0=P2=P1=table3i;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1