中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        AVR的uart串口通信程序

        作者: 時(shí)間:2018-09-14 來(lái)源:網(wǎng)絡(luò) 收藏

        //1、使用ICC的終端調(diào)試窗口(Terminal),進(jìn)行通信調(diào)試。
        //2、對(duì)ICC的終端調(diào)試窗口進(jìn)行設(shè)置,設(shè)置串口為com1或com2
        //通信波特率為19200(Tools->EnvironmentOptions...)。
        //3、將PC屏幕光標(biāo)定位于調(diào)試窗口中。
        #include
        #definefosc8000000//晶振8MHZ
        #definebaud19200//波特率
        #defineosc_address0x1ff0
        externunsignedcharread_flash(unsignedintadd);

        voidputchar(unsignedcharc)
        {
        while(!(UCSRA(1UDR=c;
        }

        unsignedchargetchar(void)
        {
        while(!(UCSRA(1returnUDR;
        }

        intputs(char*s)
        {
        while(*s)
        {
        putchar(*s);
        s++;
        }
        putchar(0x0a);//回車(chē)換行
        putchar(0x0d);
        return1;
        }

        voidputstr(char*s)
        {
        while(*s)
        {
        putchar(*s);
        s++;
        }
        }

        void_init(void)
        {
        OSCCAL=read_flash(osc_address);
        UCSRB=(1UBRRL=(fosc/16/(baud+1))%6;
        UBRRH=(fosc/16/(baud+1))/256;
        UCSRC=(1}

        voidmain(void)
        {
        unsignedchari;
        _init();
        puts(廣州天河雙龍電子公司RS232通信演示程序);
        puts(HTTP://WWW.SL.COM.CN);
        puts(MAILTsllg@sl.com.cn);
        while(1)
        {
        i=getchar();
        if(i!=0)//按PC鍵盤(pán)開(kāi)始測(cè)試
        {
        putstr(當(dāng)前按鍵是:);
        putchar(i);
        putchar(0x0a);
        putchar(0x0d);
        puts(廣州天河雙龍電子公司RS232通信演示程序);
        puts(HTTP://WWW.SL.COM.CN);
        puts(MAILTsllg@sl.com.cn);
        putchar(0x0a);
        putchar(0x0d);
        }
        }
        }

        本文引用地址:http://www.antipu.com.cn/article/201809/389164.htm


        關(guān)鍵詞: AVR uart 串口通信

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉