在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > ARM7學(xué)習(xí)---LPC2103 UART0中斷接收

            ARM7學(xué)習(xí)---LPC2103 UART0中斷接收

            作者: 時間:2016-11-18 來源:網(wǎng)絡(luò) 收藏
            花了差不多一天的時間在研究LPC2103的串口中斷接收程序,終于搞定了,從昨天晚上一直在看資料和調(diào)試,到今天中午又好好的研究了下,終于把串口中斷接收程序搞定了。哈哈!比較高興!現(xiàn)在把調(diào)試成功的程序記錄下來,以作以后學(xué)習(xí)的參考。接下來可以繼續(xù)移植我的GPS串口接收程序了。我是在Keil for ARM編譯環(huán)境中調(diào)試的,具體程序如下:

            /**************ARM7(LPC2103)練習(xí)程序**************************/
            /************************************************************************/
            /*****File Function : UART0中斷接收測試程序 *****/
            /*****Program Author : ZhengWen(ClimberWin) *****/
            /*****MCU : LPC2103F 外部11.0592M晶振 ****/
            /*****Compile Date : 2010/02/12 *****/
            /*****Edition Info : V1.0*****/
            /********************************************************************/
            //編譯環(huán)境 KEIL for ARM
            //功能:串口波特率9600 能夠中斷接收串口數(shù)據(jù),并且加1后通過串口返回數(shù)據(jù)。

            本文引用地址:http://www.biyoush.com/article/201611/316021.htm

            #include
            #define uchar unsigned char
            #define uint unsigned int
            #define baudrate 9600 //設(shè)置波特率
            #define PE (U0LSR&0x40)//定義串口數(shù)據(jù)發(fā)送忙碌與否,PE=1忙碌;PE=0;不忙綠
            #define Fosc(11059200)//晶振頻率,10MHz~25MHz,應(yīng)當(dāng)與實際一至
            #define Fcclk(Fosc * 6) //66.3552 系統(tǒng)頻率,必須為Fosc的整數(shù)倍(1~32),且<=70MHZ
            #define Fcco(Fcclk * 4) //CCO頻率,必須為Fcclk的2、4、8、16倍,范圍為156MHz~320MHz
            #define Fpclk(Fcclk / 4) * 1 //016.5888,VPB時鐘頻率,只能為(Fcclk / 4)的1 ~ 4倍

            void UART0_INT(void); //串口初始化
            void UART0_SendByte(unsigned char data); //串口發(fā)送字節(jié)
            void UART0_SendStr(unsigned char const *str);//串口發(fā)送字符串
            void __irq UART0_IRQ(void); //串口中斷接收程序
            void PLL_Init(void); //系統(tǒng)時鐘配置程序
            void delayms();

            void delayms(unsigned int count)
            {
            unsigned int i,j;
            for(i=0;ifor(j=0;j<120;j++);
            }

            void PLL_Init(void)
            {
            /* 設(shè)置系統(tǒng)各部分時鐘 */
            PLLCON = 1;
            #if ((Fcclk / 4) / Fpclk) == 1
            VPBDIV = 0;
            #endif
            #if ((Fcclk / 4) / Fpclk) == 2
            VPBDIV = 2;
            #endif
            #if ((Fcclk / 4) / Fpclk) == 4
            VPBDIV = 1;
            #endif
            #if (Fcco / Fcclk) == 2
            PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
            #endif
            #if (Fcco / Fcclk) == 4
            PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
            #endif
            #if (Fcco / Fcclk) == 8
            PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
            #endif
            #if (Fcco / Fcclk) == 16
            PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
            #endif
            PLLFEED = 0xaa;
            PLLFEED = 0x55;
            while((PLLSTAT & (1 << 10)) == 0);
            PLLCON = 3;
            PLLFEED = 0xaa;
            PLLFEED = 0x55;
            }


            /***********串口0初始化**********************/
            void UART0_INT(void)
            { unsigned int U0DL;

            PINSEL0 |= 0x00000005; //設(shè)置I/O連接到UART0
            PINSEL1 |= 0x00000000;
            U0IER=0x00000001; //使能UART0接收中斷
            U0LCR = 0x83; // DLAB = 1,可設(shè)置波特率;無奇偶校驗 1位停止位 8位數(shù)據(jù)長度。
            U0DL = (Fpclk/16)/baudrate;
            U0DLM= U0DL/256; //高8位
            U0DLL = U0DL%256; //低8位
            U0LCR = 0x03; // DLAB = 0,設(shè)置好波特率;無奇偶校驗 1位停止位 8位數(shù)據(jù)長度。

            VICIntSelect=0x00; //中斷選擇為 IQR 模式
            VICVectCntl5=(VICVectCntl5&0xffffffc0)|0x26;
            VICVectAddr5=(unsigned int)UART0_IRQ;//選擇中斷入口地址的程序
            VICIntEnClr=1<<6; //UART0中斷不使能
            }
            /***********串口發(fā)送字節(jié)**********************/
            void UART0_SendByte(unsigned char data)
            {
            U0THR = data; //發(fā)送數(shù)據(jù)
            while( PE==0 ); //等待數(shù)據(jù)發(fā)送完畢 PE=1忙碌;PE=0;不忙綠

            }
            /***********串口發(fā)送字符串**********************/
            void UART0_SendStr(unsigned char const *str)
            { while(1)
            { if( *str ==