亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? example_281xsci_autobaud.c

?? TMS320F2812的SCI串口測試程序
?? C
字號:
//###########################################################################
//
// FILE:	Example_281xSci_Autobaud_.c
//
// TITLE:	DSP281x SCI Autobaud detect example 
//
// ASSUMPTIONS:
//
//          This program requires the DSP281x V1.00 header files.  
//          As supplied, this project is configured for "boot to H0" operation. 
//
//          Test requires the following hardware connections:
//          
//          SCIATX <-> SCIBRX
//          SCIARX <-> SCIATX
//
//          This test will perform autobaud lock at a variety of baud rates, including
//          very high baud rates.  
//
//          For this test to properly run, connect the SCI-A pins to the 
//          SCI-B pins without going through a transciever.  
// 
//          At higher baud rates, the slew rate of the incoming data bits can be 
//          affected by transceiver and connector performance. This slew rate may
//          limit reliable autobaud detection at higher baud rates.  
//          
//          SCIA: Slave, autobaud locks, receives characters and
//                echos them back to the host.  Uses the RX interrupt
//                to receive characters.
//
//          SCIB: Host, known baud rate, sends characters to the slave
//                and checks that they are echoed back.
//
// DESCRIPTION:
//
//          Internal Loopback test for ever through SCIA using interrupts,
//	        FIFOs are disabled. 
//
//          Watch Variables: BRRVal - current BRR value used for SCIB
//                           ReceivedAChar - character received by SCIA
//                           ReceivedBChar - character received by SCIB
//                           SendChar      - character being sent by SCIB
//                           SciaRegs.SCILBAUD - SCIA baud registers - set
//                           SciaRegs.SCIHBAUD   by autobaud lock
//		
//
//###########################################################################
//
//  Ver | dd mmm yyyy | Who  | Description of changes
// =====|=============|======|===============================================
// 1.00 | 11 Sep 2003 | L.H. | First Release 
//###########################################################################


#include "DSP281x_Device.h"     // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"   // DSP281x Examples Include File

#define BAUDSTEP 100            // Amount BRR will be incremented between each
                                // autobaud lock

// Prototype statements for functions found within this file.
void scia_init(void);
void scib_init(void);
void scia_xmit(int a);
void scib_xmit(int a);
void scia_AutobaudLock(void);
void error(int);
interrupt void rxaint_isr(void); 


// Global counts used in this example
Uint16 LoopCount;
//Uint16 xmitCount;
Uint16 ReceivedCount;
Uint16 ErrorCount; 
Uint16 SendChar;
Uint16 ReceivedAChar;   // scia received character
Uint16 ReceivedBChar;   // scib received character
Uint16 BRRVal;
Uint16 Buff[10] = {0x55, 0xAA, 0xF0, 0x0F, 0x00, 0xFF, 0xF5, 0x5F, 0xA5, 0x5A};

void main(void)
{
   Uint16 i;

// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
   InitSysCtrl();

// Step 2. Initalize GPIO: 
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio();  // Skipped for this example  

   EALLOW;
   GpioMuxRegs.GPFMUX.all=0x0030;	// Select GPIOs to be Scia pins	 
                                    // Port F MUX - x000 0000 0011 0000
   GpioMuxRegs.GPGMUX.all=0x0030;	// Select GPIOs to be Scib pins	 
                                    // Port G MUX - x000 0000 0011 0000
   EDIS;

// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.  
// This function is found in the DSP281x_PieCtrl.c file.
   InitPieCtrl();
   
// Disable CPU interrupts and clear all CPU interrupt flags:
   IER = 0x0000;
   IFR = 0x0000;

// Initialize the PIE vector table with pointers to the shell Interrupt 
// Service Routines (ISR).  
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
   InitPieVectTable();

// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.  
   EALLOW;	    // This is needed to write to EALLOW protected registers
   PieVectTable.RXAINT = &rxaint_isr;
   EDIS;       // This is needed to disable write to EALLOW protected register

// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
   scia_init();       // Initalize SCIA
   scib_init();       // Initalize SCIB

// Step 5. User specific code, enable interrupts:
	
   LoopCount = 0;
   ErrorCount = 0;
    
// Enable interrupts
   PieCtrlRegs.PIEIER9.all = 0x0001; // Enable all SCIA RXINT interrupt
   IER |= 0x0100;			         // enable PIEIER9, and INT9
   EINT;
    
    // Start with BRR = 1, work through each baud rate setting
    // incrementing BRR by BAUDSTEP
    for (BRRVal = 0x0000; BRRVal < (Uint32)0xFFFF; BRRVal+=BAUDSTEP)
    {
          
        // SCIB has a known baud rate.  SCIA will autobaud to match  
	    ScibRegs.SCIHBAUD = (BRRVal >> 8);
	    ScibRegs.SCILBAUD = (BRRVal);    
	    
	    // Initiate an autobaud lock with scia.  Check
	    // returned character against baud lock character 'A' 
	    scia_AutobaudLock();
	    while(ScibRegs.SCIRXST.bit.RXRDY != 1) { } 
	    ReceivedBChar = 0;
	    ReceivedBChar =  ScibRegs.SCIRXBUF.bit.RXDT;
	    if(ReceivedBChar != 'A') 
	    {
	        error(0);
	    }
    
	    // Send/echoback characters
	    // 55 AA F0 0F 00 FF F5 5F A5 5A 
	    for(i= 0; i<=9; i++) 
	    {
	      SendChar = Buff[i];
	      scib_xmit(SendChar);			    // Initiate interrupts and xmit data in isr
	      // Wait to get the character back and check
	      // against the sent character.
	      while(ScibRegs.SCIRXST.bit.RXRDY != 1) 
	      { 
	          asm("   NOP");
	      } 
	      ReceivedBChar = 0;
	      ReceivedBChar =  ScibRegs.SCIRXBUF.bit.RXDT;
	      if(ReceivedBChar != SendChar) error(1);
	    }
    
    } // Repeat for next BRR setting 
    
    // Stop here, no more
    for(;;)
    {
       asm("    NOP");
    }


} 	


/* --------------------------------------------------- */
/* ISR for PIE INT9.1                                  */
/* Connected to RXAINT  SCI-A                          */
/* ----------------------------------------------------*/
     
interrupt void rxaint_isr(void)     // SCI-A
{
  // Insert ISR Code here
   
   PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
   
   // If we were autobaud detecting, we must clear CDC
   if(SciaRegs.SCIFFCT.bit.CDC == 1) 
   {
      SciaRegs.SCIFFCT.bit.ABDCLR = 1;
      SciaRegs.SCIFFCT.bit.CDC = 0;
      // Check received character - should be 'A'
      ReceivedAChar = 0;
      ReceivedAChar = SciaRegs.SCIRXBUF.all;
      if(ReceivedAChar != 'A') 
      {
         error(2);
      }
      else scia_xmit(ReceivedAChar);       
   }  
   
   // This was not autobaud detect
   else 
   {      
      // Check received character against sendchar
      ReceivedAChar = 0;
      ReceivedAChar = SciaRegs.SCIRXBUF.all;
      if(ReceivedAChar != SendChar) 
      {
         error(3);
      }
      else scia_xmit(ReceivedAChar);
   }
      
   SciaRegs.SCIFFRX.bit.RXFFINTCLR = 1;	// clear Receive interrupt flag  
   ReceivedCount++;
}


void error(int ErrorFlag)
{
      ErrorCount++;
      asm("     ESTOP0");  	       // Uncomment to stop the test here
      for (;;);

}

// SCIA  8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity 
void scia_init()
{    
    // Note: Clocks were turned on to the SCIA peripheral
    // in the InitSysCtrl() function

    // Reset FIFO's 
    SciaRegs.SCIFFTX.all=0x8000;
        
    SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback 
                                   // No parity,8 char bits,
                                   // async mode, idle-line protocol
    SciaRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK, 
                                   // Disable RX ERR, SLEEP, TXWAKE
    SciaRegs.SCICTL2.all =0x0003; 
    SciaRegs.SCICTL2.bit.RXBKINTENA =1;
    SciaRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset 


}

// SCIB  8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity 
 
void scib_init()
{
    // Reset FIFO's 
    ScibRegs.SCIFFTX.all=0x8000;

    // 1 stop bit, No parity, 8-bit character
    // No loopback
    ScibRegs.SCICCR.all = 0x0007;
    
    // Enable TX, RX, Use internal SCICLK
    ScibRegs.SCICTL1.all = 0x0003; 

    // Disable RxErr, Sleep, TX Wake, 
    // Diable Rx Interrupt, Tx Interrupt
    ScibRegs.SCICTL2.all = 0x0000;

    // Relinquish SCI-A from reset
    ScibRegs.SCICTL1.all = 0x0023;
     
    return;
} 




// Transmit a character from the SCI-A'
void scia_xmit(int a)
{
    SciaRegs.SCITXBUF=a;
}

// Transmit a character from the SCI-B'
void scib_xmit(int a)
{
    ScibRegs.SCITXBUF=a;
}  
    

//------------------------------------------------
// Perform autobaud lock with the host. 
// Note that if autobaud never occurs 
// the program will hang in this routine as there
// is no timeout mechanism included. 
//------------------------------------------------
                                
void scia_AutobaudLock()
{
    Uint32 i;
    
    SciaRegs.SCICTL1.bit.SWRESET = 0;
    SciaRegs.SCICTL1.bit.SWRESET = 1;
    
    // Must prime baud register with >= 1
    SciaRegs.SCILBAUD = 1;
    
    // Prepare for autobaud detection
    // Make sure the ABD bit is clear by writing a 1 to ABDCLR
    // Set the CDC bit to enable autobaud detection
    SciaRegs.SCIFFCT.bit.ABDCLR = 1;
    SciaRegs.SCIFFCT.bit.CDC = 1;
    
    // Wait until we correctly read an 
    // 'A' or 'a' and lock    
    while(SciaRegs.SCIFFCT.bit.CDC == 1) 
    {
       // Note the lower the baud rate the longer
       // this delay has to be
       for(i = 1; i<= 0x0FFFFFF; i++) 
       {
          asm("     NOP");
       }  // delay
       
       if(SciaRegs.SCIFFCT.bit.CDC == 1) scib_xmit('A');
    }

    return;   
}
    


//===========================================================================
// No more.
//===========================================================================

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品国产一区二区三区不卡| 91 com成人网| 日韩一级完整毛片| 国产精品免费观看视频| 美女脱光内衣内裤视频久久网站| 成人午夜视频免费看| 日韩欧美中文一区二区| 一区二区三区四区在线免费观看 | 亚洲欧美日韩一区二区| 久草在线在线精品观看| 欧美日韩免费电影| 亚洲伦在线观看| 成人午夜视频在线| 国产日韩欧美一区二区三区乱码| 水蜜桃久久夜色精品一区的特点 | 国产一区二区在线看| 久久免费视频色| 久久精品国内一区二区三区| 欧美性视频一区二区三区| 亚洲欧洲精品一区二区三区| 风间由美一区二区三区在线观看| 精品国产一区二区三区久久久蜜月| 亚洲电影一级片| 91福利视频在线| 一区二区三区av电影| 一本到不卡精品视频在线观看| 国产精品人成在线观看免费| 国产jizzjizz一区二区| 久久亚洲综合色一区二区三区 | 韩国精品主播一区二区在线观看| 91精品免费观看| 日本不卡123| 欧美一区二区大片| 久久99精品久久久久婷婷| 日韩欧美色综合| 国产最新精品精品你懂的| 精品电影一区二区| 国产91综合一区在线观看| 国产精品情趣视频| 91亚洲精华国产精华精华液| 一区二区三区资源| 欧美日韩成人高清| 麻豆91免费观看| 国产日韩欧美精品在线| 风间由美一区二区av101| 亚洲精品亚洲人成人网| 国产日韩欧美电影| 成人精品小蝌蚪| 亚洲综合成人在线视频| 欧美一区二区三区视频免费| 狠狠色丁香婷综合久久| 中文字幕乱码一区二区免费| 色狠狠桃花综合| 日本vs亚洲vs韩国一区三区 | 91精品国产品国语在线不卡| 久草精品在线观看| 中文字幕视频一区二区三区久| 日本韩国精品一区二区在线观看| 日韩精品亚洲一区二区三区免费| 欧美电影免费观看完整版| 国产成人99久久亚洲综合精品| 亚洲日本在线看| 欧美一区二区观看视频| 成人av在线资源| 爽好多水快深点欧美视频| 国产欧美一区在线| 欧美午夜精品久久久| 精东粉嫩av免费一区二区三区| 国产精品久线在线观看| 91精品国产综合久久香蕉麻豆| 国产成人一区在线| 丝袜脚交一区二区| 亚洲丝袜制服诱惑| 精品久久久久久久久久久久久久久久久| 成人app在线| 不卡一区在线观看| 久久精品国产免费看久久精品| 中文字幕一区二区三区色视频| 日韩欧美一区电影| 在线观看日产精品| 国产精品88av| 男人的j进女人的j一区| 一区二区三区**美女毛片| 久久久久久久网| 欧美一级在线视频| 在线影院国内精品| 成人av午夜电影| 激情综合五月婷婷| 日日夜夜免费精品视频| 亚洲色图欧美偷拍| 国产人妖乱国产精品人妖| 日韩一区二区在线看片| 91福利区一区二区三区| 91在线无精精品入口| 国产一区在线不卡| 蜜桃视频一区二区三区| 亚洲va天堂va国产va久| 亚洲一区电影777| 亚洲三级电影网站| 亚洲欧洲日韩av| 国产精品久久久久久久午夜片 | 国产激情91久久精品导航| 日本伊人午夜精品| 午夜视频久久久久久| 亚洲国产一区二区视频| 亚洲欧美日韩中文播放| 亚洲同性同志一二三专区| 中文字幕在线一区| 国产精品青草综合久久久久99| 国产欧美一区二区精品仙草咪| 精品国产三级电影在线观看| 日韩视频在线你懂得| 欧美一区二区三区日韩视频| 欧美一区二区三区的| 欧美一个色资源| 欧美一级片在线观看| 欧美一级电影网站| 精品av久久707| 亚洲精品一区二区三区在线观看| 精品999久久久| 久久尤物电影视频在线观看| 国产亚洲精品aa午夜观看| 国产香蕉久久精品综合网| 久久精品日产第一区二区三区高清版| 久久精品亚洲精品国产欧美kt∨| 久久女同性恋中文字幕| 国产精品情趣视频| 亚洲综合在线五月| 三级不卡在线观看| 国内欧美视频一区二区| 国产91色综合久久免费分享| 成人av资源站| 欧美日韩一区二区三区四区| 日韩一区二区三| 国产午夜久久久久| 亚洲激情男女视频| 日韩国产成人精品| 国产99久久久国产精品免费看 | 中文字幕一区二区三区在线不卡| 亚洲精品成a人| 日本免费在线视频不卡一不卡二 | 午夜久久久久久久久久一区二区| 奇米777欧美一区二区| 国产精品资源网| 欧美中文字幕一区二区三区| 日韩免费视频线观看| 中文字幕一区二区三区在线观看| 亚洲va在线va天堂| 国产福利一区二区三区在线视频| 色婷婷亚洲一区二区三区| 欧美一区二区网站| 中文字幕一区二区三| 麻豆一区二区99久久久久| 不卡大黄网站免费看| 91精品国产综合久久国产大片| 国产欧美精品在线观看| 午夜视频在线观看一区二区| 国产成人av一区二区三区在线观看| 91成人网在线| 久久久99久久| 日本不卡不码高清免费观看| 不卡一卡二卡三乱码免费网站| 7777精品伊人久久久大香线蕉经典版下载 | 韩国在线一区二区| 欧美亚洲动漫精品| 国产午夜精品福利| 日产国产欧美视频一区精品| 成人小视频免费观看| 欧美电影精品一区二区| 亚洲精品欧美在线| 懂色av一区二区夜夜嗨| 欧美一区二区视频在线观看| 亚洲精品久久7777| 成熟亚洲日本毛茸茸凸凹| 日韩一二三四区| 天天操天天综合网| 91精品91久久久中77777| 中文字幕免费观看一区| 激情综合网天天干| 91精品国产日韩91久久久久久| 一区二区三区日韩精品视频| 国产91丝袜在线播放| 久久色视频免费观看| 麻豆精品视频在线观看视频| 欧美日韩一区二区三区免费看| 亚洲天天做日日做天天谢日日欢| 国产激情一区二区三区| 久久亚洲综合av| 麻豆国产精品777777在线| 337p亚洲精品色噜噜噜| 香蕉久久一区二区不卡无毒影院| 日本道色综合久久| 亚洲欧美一区二区三区极速播放 | 久久精品国产99国产| 91超碰这里只有精品国产| 性久久久久久久| 777色狠狠一区二区三区| 日韩精品一级二级| 69堂国产成人免费视频| 视频一区二区不卡|