📄 595.c
字号:
#include "595.H"
#include <stdio.h>
#include <reg52.h>
#include <intrins.h>
#include <string.h>
sbit CS1=P0^5;
sbit SCK1=P0^4;
sbit SI1=P0^6;
//unsigned char idata outbyte=0xff;
unsigned char code charcode[18]={0x82,0xfa,0x46,0x52,0x3a,0x13,0x03,0xda,0x02,0x12,0x7f,0x1a,0x13,0x67,0x7f,0xff,0x62};//d
//*******************************
void OutByte1(unsigned char b)
{
unsigned char i,j;
unsigned char bb=0x80;
//CS1=0;
for(i=0;i<8;i++)
{
//SCK11=0;
SI1=b&bb;
for(j=0;j<76;j++);
bb>>=1;
for(j=0;j<76;j++);
SCK1=0;
for(j=0;j<76;j++);
SCK1=1;
for(j=0;j<76;j++);
}
// CS1=1;
}
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$4
void SendStr_MAX7219(unsigned char *Data)
{
unsigned char i,j;
CS1=0;
for(j=0;j<76;j++);
for(i=0;i<4;i++)
{ if(Data[i]==0x64)
Data[i]=16;//charcode[14];
if(Data[i]>=0x30)
Data[i]=Data[i]-0x30;
if(Data[i]==0x20)
Data[i]=15;//charcode[14];
}
if(Data[0]==0x2d)Data[0]=10;//-
OutByte1(charcode[Data[3]]);
for(j=0;j<76;j++);
OutByte1(charcode[Data[2]]);
for(j=0;j<76;j++);
OutByte1((charcode[Data[1]])&0xfd);
for(j=0;j<76;j++);
OutByte1(charcode[Data[0]]);
for(j=0;j<76;j++);
CS1=1;
for(j=0;j<176;j++);
CS1=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -