74HC595驅(qū)動(dòng)程序2例
void WriteSIOByte(unsigned char val)
{
unsigned char i;
ACC = val;
for (i = 8; i > 0; i --) {
SRCLK = 0;//拉低74HC595時(shí)鐘
_rrca_();//右移一位數(shù)據(jù)
SER = CY;//發(fā)送74HC595一位串行數(shù)據(jù)
SRCLK = 1;//拉高74HC595時(shí)鐘
_nop_();//延時(shí)
}
SER = 1;//釋放數(shù)據(jù)總線
//以下3條指令若在多字節(jié)時(shí),應(yīng)該移入多字節(jié)全發(fā)送完后在執(zhí)行此3條指令
RCLK = 0;
_nop_();//延時(shí)
RCLK = 1;//打入并行數(shù)據(jù)
}
74ls595"速射"
hotpower
for(i = 0; i < buffsize; i ++){
SBUF = siobuff[i];
while(TI == 0);
TI = 0;
}
RCLK = 0;
_nop_();//延時(shí)
RCLK = 1;//打入并行數(shù)據(jù)