用两个74hc545驱动88点阵,显示口字不知道错哪了,大神指点一二
2019-07-14 20:01发布
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
#include <reg52.h>
#include <intrins.h>
unsigned char NUM[]={0xff,0xbf,0xdf,0xef,0xf7,0xff,0xff,0xff};
unsigned char table[]={0xff,0x40,0x20,0x10,0x08,0xff,0xff,0xff};
sbit SI=P1^0;//
sbit RCK=P1^1;/
sbit SCK=P2^5; //
void delayms(unsigned int x)
{ unsigned int i,j;
for(i=x;i>0;i--)
for(j=110;j>0;j--);
}
void HC595SendData(unsigned char SendVal)//
{
unsigned char i;
for(i=0;i<8;i++)
{
if((SendVal<<i)&0x80) SI=1;
else SI=0;
SCK=0;//´
_nop_();
_nop_();
SCK=1;
}
}
void HC595ShowData()//
{
RCK=0;
_nop_();
_nop_();
RCK=1;
}
void main(void)
{
unsigned char i,j;
while(1)
{
for(i = 0; i < 8; i++)
{
HC595SendData(NUM);
HC595SendData (0xff);
HC595ShowData();
delayms(100);
}
for(j = 0; j < 8; j++)
{
HC595SendData(table[j]);
HC595SendData (0xff);
HC595ShowData();
delayms(100);
}
}
}
一周热门 更多>