|
#include <reg52.h>
#include<intrins.h>
sbit DIO = P3^4; //串行数据口
sbit S_CLK = P3^5; //移位寄存器时钟
sbit R_CLK = P3^6; //输出锁存器时钟
unsigned char code tabel [8] = {
0xFF,0xF7,0xFB,0x81,0x81,0xFB,0xF7,0xFF
};
void Send_Byte(unsigned char dat)
{
unsigned char i;
S_CLK = 0;
R_CLK = 0;
for(i=0; i<8; i++)
{
if(dat & 0x01)
DIO = 1;
else
DIO = 0;
S_CLK = 1;
dat >>= 1;
S_CLK = 0;
}
}
void main()
{
//ROW 0x80 , col 0xfe
unsigned char j, ROW;
while(1)
{
ROW = 0x80;
for(j=0; j<8; j++)
{
Send_Byte(tabel[j]);
Send_Byte(ROW);
R_CLK = 1;
R_CLK = 0;
ROW = _cror_(ROW, 1);
}
}
}
|
评分
-
查看全部评分
|