请老师发图上来看看、我参考下!有没什么地方不对的。
#include<reg52.h>
sbit HC595_DS = P3^0;
sbit HC595_STCP = P3^1;
sbit HC595_SHCP = P3^2;
sbit HC595_OE = P3^7;
void HC595_WriteByte(unsigned char value)
{
unsigned char i;
for(i=0;i<8;i++)
{
HC595_SHCP = 0;
HC595_DS = value&(0x80>>i);
HC595_SHCP = 1;
}
}
void Lattice_WriteData(unsigned char *buffer,unsigned char value,unsigned char value1)
{
while(*buffer)//列扫描
{
HC595_WriteByte(*buffer++);
}
HC595_WriteByte(value);//行数据低八位
HC595_WriteByte(value1);//行数据高八位
HC595_STCP = 0;
HC595_STCP = 1;
}
unsigned char buffer[8]={0x01,0,0,0,0,0,0,0};//64列
void main()
{
HC595_OE = 0;
HC595_OE = 1;
//假设行低电平有效,列高电平有效,显示效果为第一行,第一列坐标为(0,0)的像素点亮,其他均不亮
Lattice_WriteData(buffer,0xfe,0xff);
while(1);
}
还请老师指点下。
|