如圖仿u2u3兩個595進行點陣掃描,U4U5進行字模顯示一直都是亂碼
單片機程序如下:
#include <REG52.H>
sbit ds0= P3^0;
sbit sh0= P3^1;
sbit st= P3^2;
sbit ds2= P3^3;
sbit sh2= P3^4;
unsigned char code unmber[]={
0xFF,0xFF,0xFF,0xFF,0xE8,0x7B,0xED,0x7D,0xDB,0x61,0xC3,0x1F,0xFF,0x7F,0xFF,0x03,
0x80,0xFD,0xFB,0x3B,0xF6,0xC7,0xEE,0xF7,0xEE,0xF9,0xFE,0xFD,0xFF,0xFD,0xFF,0xFF,/*"張",0*/
};
void hc595(unsigned char x)
{
sh2=0;
ds2=x&0x01;
x=x<<1;
sh2=1;
}
void dianzhen()
{
unsigned char j,k,i;
for(j=0;j<16;j++)
{
ds0=j;
sh0=0;
sh0=1;
{
hc595(unmber[(2*j+1)]);
hc595(unmber[(2*j+0)]);
}
st=0;
st=1;
}
}
void main()
{
while(1)
{
dianzhen();
}
}
|