?? hc595.c.c
字號(hào):
#include <reg51.h> //51芯片管腳定義頭文件
#include <intrins.h> //內(nèi)部包含延時(shí)函數(shù) _nop_();
#define uchar unsigned char
#define uint unsigned int
uchar code table[]={0xC0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
sbit SER=P2^2; //595串行數(shù)據(jù)輸入
sbit SCK=P2^1; //595移位時(shí)鐘
sbit RCK=P2^0; //595數(shù)據(jù)輸出脈沖
uchar temp,aa;
void display(uchar aa )
{
uchar j;
temp=table[aa];
for(j=0;j<8;j++)
{
RCK=0;
SCK=0;
temp=temp<<1 ;
SER=temp&0x80;
SCK=1;
RCK=1;
}
}
void delay()
{
uchar i,j;
for(i=10;i>0;i--)
for(j=1100;j>0;j--);
}
void main() //測(cè)試。。。。。。。。。。。。。。。。
{
SCK=0;
RCK=1;
while(1)
{
display(3);
delay();
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -