新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 串行數(shù)據(jù)轉(zhuǎn)換成并行數(shù)據(jù)

串行數(shù)據(jù)轉(zhuǎn)換成并行數(shù)據(jù)

作者: 時(shí)間:2016-11-17 來(lái)源:網(wǎng)絡(luò) 收藏
C代碼:

本文引用地址:http://butianyuan.cn/article/201611/315525.htm

#include // 包含頭文件
sbit HC164_data = P3^0; // 端口引腳定義。,數(shù)據(jù)輸出端,
sbit HC164_CLK = P3^1; //時(shí)鐘輸出端
// 延時(shí)函數(shù)
void delay(void)
{
unsigned int i,j;
for(i=0;i<1000;i++)
{
for(j = 0;j < 500;j++);
}
}
// 主函數(shù)
void main(void)
{
unsigned char i;
P3 = 0x00;
for(i = 0;i < 8;i++) //
{
HC164_data = 1 << i; // 數(shù)據(jù)串行輸出,一次移動(dòng)一位
HC164_CLK = 1; // 數(shù)據(jù)在上升沿期間輸出
HC164_CLK = 0; //
delay();
}
while(1)
{
}
}

仿真原理圖:



評(píng)論


技術(shù)專(zhuān)區(qū)

關(guān)閉