求大佬指点怎么改成左移或者其他动态显示
- # include <reg52.h>
- typedef unsigned char uchar;
- uchar code Bmp031[]=
- {
- 0xF7,0xFF,0x07,0xFE,0xDB,0x83,0xDF,0xBB,0x01,0xBA,0x9F,0xBB,0x5F,0x83,0xEF,0xFE,
- 0xFF,0xFF,0x1F,0xE0,0xDF,0xEF,0x1F,0xE0,0xDF,0xEF,0xDF,0xEF,0x1F,0xE0,0xDF,0xEF,
- };
- uchar code Bmp032[]=
- {
- 0x7F,0xFF,0xFF,0xFE,0x03,0x80,0x7B,0xFF,0x7B,0xFF,0x03,0xC0,0xBB,0xFD,0xDB,0xFD,
- 0x0B,0xC0,0xDB,0xFD,0xFB,0xFD,0x03,0x80,0xFB,0xFD,0xFD,0xFD,0xFD,0xFD,0xFE,0xFD,
- };
- uchar code Bmp033[]=
- {
- 0x7F,0xFF,0x7F,0xFF,0x7F,0xFF,0x03,0xE0,0x7B,0xEF,0x7B,0xEF,0x03,0xE0,0x7B,0xEF,
- 0x7B,0xEF,0x7B,0xEF,0x03,0xE0,0x7B,0xEF,0x7F,0xBF,0x7F,0xBF,0xFF,0x80,0xFF,0xFF,
- };
- uchar *bmp[3];
- sbit SHCP = P0^4; //移位时钟
- sbit STCP = P2^3; //锁存时钟
- sbit DATE = P0^2; //数据输入
- sbit OE = P2^4; //输出使能
- void out595_datdu(uchar du0, uchar du1, uchar HBIT, uchar LBIT )
- {
- uchar i,j,k,z;
- STCP = 0;
- for (i = 0; i < 8; i++)
- {
- SHCP = 0;
- if (du0 & 0x80)
- {
- DATE = 1;
- }
- else
- DATE = 0;
-
- SHCP = 1;
- SHCP = 0;
- du0 <<= 1;
- }
- for (j = 0; j < 8; j++)
- {
- SHCP = 0;
- if (du1 & 0x80)
- {
- DATE = 1;
- }
- else
- DATE = 0;
-
- SHCP = 1;
- SHCP = 0;
- du1 <<= 1;
- }
- for (k = 0; k < 8; k++)
- {
- SHCP = 0;
- if (HBIT & 0x80)
- {
- DATE = 1;
- }
- else
- DATE = 0;
-
- SHCP = 1;
- SHCP = 0;
- HBIT<<=1;
- }
- for (z = 0; z < 8; z++)
- {
- SHCP = 0;
- if (LBIT & 0x80)
- {
- DATE = 1;
- }
- else
- DATE = 0;
-
- SHCP = 1;
- SHCP = 0;
- LBIT<<=1;
- }
- }
- void DlyMs(unsigned int dly)
- {
- unsigned int tmp;
- while(dly--)
- {
- for(tmp=0;tmp<2;tmp++);
- }
- }
-
- void main(void)
- {
- unsigned char i,j;
- unsigned short int tmp;
- OE = 0;
- bmp[0] = Bmp033;
- bmp[1] = Bmp032;
- bmp[2] = Bmp031;
- while(1)
- {
- tmp = 1;
- for(j=0;j<16;j++)
- {
- for(i=0;i<3;i++)out595_datdu(bmp[i][j*2+1], bmp[i][j*2],~(tmp>>8),~tmp);
- tmp <<= 1;
- STCP = 1;
- STCP = 0;
- }
- DlyMs(1);
- }
- }
复制代码
|