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

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

输出口。

数据有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该序列



原文地址:https://www.cnblogs.com/hrhguanli/p/4601501.html