?? 51
字號(hào):
//Note: 74HC595驅(qū)動(dòng)
// __ __
//Note: MR 主復(fù)位接電源正極, OE 使能端,輸出有效接電源負(fù)極
/*--------------------------------------------*/
#ifndef __74HC595_H__
#define __74HC595_H__
/*--------------------------------------------*/
sbit SD = P1^4; //串行數(shù)據(jù)輸入
sbit ST_CK = P1^5; //存儲(chǔ)寄存器時(shí)鐘輸入
sbit SH_CK = P1^6; //移位寄存器時(shí)鐘輸入
/*--------------------------------------------*/
//數(shù)碼管斷碼和位碼的定義
//unsigned char code seg[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x00,0xff};
//0 1 2 3 4 5 6 7 8 9 a b c d e f 8 無(wú)
//unsigned char code pos[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
//1 2 3 4 5 6 7 8
/*--------------------------------------------*/
//函數(shù)聲明
void Ser_IN(unsigned char Data); //串行數(shù)據(jù)輸入
void Par_OUT(void); //串行數(shù)據(jù)輸出
//void Ser_Par(unsigned char Data); //串行輸入,并行輸出
/*--------------------------------------------*/
//串行數(shù)據(jù)輸入
void Ser_IN(unsigned char Data)
{
unsigned char i;
for(i = 0; i < 8; i++)
{
SH_CK = 0; //CLOCK_MAX=100MHz
SD = Data & 0x80;
Data <<= 1;
SH_CK = 1;
}
}
/*--------------------------------------------*/
//并行數(shù)據(jù)輸出
void Par_OUT(void)
{
ST_CK = 0;
ST_CK = 1;
}
/*--------------------------------------------*/
//串行輸入,并行輸出
/*void Ser_Par(unsigned char Data)
{
Ser_IN(Data);
Par_OUT();
}
*/
/*--------------------------------------------*/
#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -