在学51,但是做到led点阵的时候,不明白这个数组怎么调用的。希望各位大神指点一下。(好像是C语言的问题,自己C学的太差了。。。。。)- unsigned char code tab2[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,252,252} ;
- unsigned char code tab3[] = {8,2,8,2,4,17,62,63,162,16,98,16,34,17,62,18,34,18,34,16,34,16,34,16,62,10,34,4,0,0,0,0};
- unsigned char code tab4[] = {0,16,190,63,2,2,186,31,170,16,170,20,170,20,186,20,138,20,138,20,170,20,26,10,1,49,193,32,0,0,0,0};
- unsigned char code tab5[] = {64,0,128,0,254,31,34,16,241,11,40,2,68,1,192,1,32,2,248,63,23,4,16,4,16,4,240,7,0,0,0,0};
- unsigned char code tab6[] = {0,1,0,1,63,1,32,63,162,32,148,18,84,2,8,2,8,2,20,5,36,5,162,8,65,16,32,32,0,0,0,0};
- unsigned char code tab7[] = {2,1,196,16,36,62,32,18,32,18,39,18,36,18,164,18,100,18,36,26,4,2,10,2,49,0,192,63,0,0,0,0};
- unsigned char code tab8[] = {16,2,16,18,232,63,8,2,204,31,74,18,73,18,200,31,8,18,72,2,136,2,8,1,136,6,104,56,0,0,0,0};
- unsigned char code tab9[] = {0,8,252,31,132,8,132,8,252,15,132,8,132,8,132,8,252,15,132,8,132,8,130,8,130,10,129,4,0,0,0,0};
- unsigned char code tab10[] = {16,2,32,1,254,31,32,1,36,9,40,5,255,63,0,0,248,7,8,4,248,7,8,4,8,4,248,7,0,0,0,0} ;
- unsigned char code tab11[] = {64,0,64,0,64,8,254,31,66,8,66,8,66,8,66,8,254,15,64,0,64,0,64,0,64,0,64,0,0,0,0,0};
- unsigned char code tab12[] = {0,8,254,31,16,2,16,2,16,2,16,18,255,63,16,2,16,2,16,2,16,2,8,2,4,2,3,2,0,0,0,0};
- unsigned char code tab13[] = {32,2,36,4,36,4,34,16,254,63,32,0,224,15,80,8,80,4,136,2,8,1,132,2,98,60,29,16,0,0,0,0};
- unsigned char code tab14[] = {4,8,4,30,196,1,95,0,196,15,68,8,78,9,86,9,69,5,69,5,68,2,36,5,164,56,84,16,0,0,0,0};
- unsigned char code tab15[] = {0,0,0,0,60,240,102,156,67,130,0,0,0,0,0,0,0,0,0,0,48,24,96,8,192,7,0,0,0,0,0,0};
- unsigned char code tab16[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- void main(void)
- {
- int k, j, ms;
-
- //--定义一个指针数组指向每个汉字--//
- uchar *p[] =
- {tab17, tab1, tab2, tab3, tab4, tab5, tab6, tab7, tab8,
- tab9, tab10, tab11, tab12, tab13, tab14, tab15, tab16};
- while(1)
- {
- for(ms = 20; ms > 0; ms--) //移动定格时间设置
- {
- for(k = 0; k < 16; k++) //显示一个字
- {
- HC595SendData(~(*(p[0] + 2*(k+j) + 1)),~(*(p[0] + 2*(k+j) )),tab0[2*k],tab0[2*k + 1]);
- //因为字模软件取的数组是高电平有效,所以列要取反
- }
-
- //--清屏--//
- HC595SendData(0xff,0xff,0,0); //清屏
- }
-
- j++;
- if(j == (17*15) )
- {
- j = 0;
- }
-
- }
- }
复制代码
|