8*8LED点阵
实验代码
c
#include "reg52.h"
#include "intrins.h"
typedef unsigned int u16;
typedef unsigned char u8;
u8 lednum=0x80;
sbit SHCP=P3^6;
sbit SER=P3^4;
sbit STCP=P3^5;
void HC595SENDBYTE(u8 dat)
{
u8 a;
SHCP=1;
STCP=1;
for(a=0;a<8;a++)
{
SER=dat>>7;
dat<<=1;
SHCP=0;
_nop_();
_nop_();
SHCP=1;
}
STCP=0;
_nop_();
STCP=1;
}
void main()
{
P0=0X7F;
while(1)
{
HC595SENDBYTE(lednum);
}
}