首页 > 其他 > 详细

输入和输出移位寄存器的同步串行模式

时间:2015-06-26 10:52:21      阅读:134      评论:0      收藏:0      [点我收藏+]

输入和输出移位寄存器的同步串行模式

输出口。

数据有RXD(P3.0)引脚输入或输出。同步移位脉冲由TXD(P3.1)引脚输出。

发送和接受均为8位数据。低位在前,高位在后。


//串行口工作模式0


#include <reg52.h>
#define uchar unsigned char 
#define uint unsigned int
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
SCON=0;
EA=1;
ES=1;
TI=0;
while(1)
{
SBUF=0xaa;
//delayms(1);
}
}
void ser0() interrupt 4
{
TI=0;
}

使用 示波器看波形 需要注意的是留在传输数据的状态。01010101该序列



输入和输出移位寄存器的同步串行模式

原文:http://www.cnblogs.com/hrhguanli/p/4601501.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!