標題: 單片機串口方式0實現并行數據、串行數據轉換 [打印本頁]

作者: 18789007389    時間: 2018-7-16 17:04
標題: 單片機串口方式0實現并行數據、串行數據轉換
#include <reg52.h>
#include <intrins.h>
#include <stdio.h>
#define uint unsigned int
#define uchar unsigned char
sbit SPL = P2^5;

void Delay(uint x)
{
         uchar i;
        while(x--)
        {
                 for(i=0;i<120;i++);
        }
}

void main()
{
         SCON = 0x10;
        while(1)
        {
                 SPL = 0;
                SPL = 1;
                while(RI == 0);
                RI = 0;
                P0 = SBUF;
                Delay(20);
        }
}






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1