微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > DSP学习交流 > 关于DSP2812的SCI口调试的求助

关于DSP2812的SCI口调试的求助

时间:10-02 整理:3721RD 点击:
我的设计是把SCI口上的发送的数据在串口调试助手上显示一下,简单的显示一个数字就好,用的是SCI-A口和MAX232相连接现在程序贴出来,请各位指教下有什么错误,好改正,现在不知道错在哪里?谢谢啦
#include "DSP28_Device.h"
Uint16 RecieveChar;

// Global counts used in this example
Uint16 LoopCount;
Uint16 ErrorCount;
void Scia_init() {
         EALLOW;
         GpioMuxRegs.GPFMUX.all = 0x0030;//  设置F4和F5为通信端口
         EDIS;
         SciaRegs.SCICCR.all = 0x07;           //  禁止接收和发送中断
         
         SciaRegs.SCICTL1.all= 0x03; //enable TX
         ScibRegs.SCICTL2.all = 0x03; //
         
         SciaRegs.SCIHBAUD    =0x0000;
   SciaRegs.SCILBAUD    =0x000F;
   
   SciaRegs.SCIFFTX.all=0xC028;
   SciaRegs.SCIFFRX.all=0x0028;
   SciaRegs.SCIFFCT.all=0x00;
   
// SciaRegs.SCICTL2.bit.RXBKINTENA =1;
   
   ScibRegs.SCICTL1.all = 0x23;// Relinquish SCI from Reset
}
// Transmit a character from the SCI
void scia_xmit(int a)
{
    SciaRegs.SCITXBUF=a;

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

}  
void main() {
           Uint16 SendChar;
     
     InitSysCtrl();
     InitSciGpio();
     // Step 3. Clear all interrupts and initialize PIE vector table:
     // Disable CPU interrupts
     DINT;
     IER = 0x0000;
     IFR = 0x0000;
     
// 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 DSP2833x_PieCtrl.c file.
   InitPieCtrl();
   
// 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 DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
   InitPieVectTable();
   
   for(;;)
    {
       scia_xmit(SendChar);

       while(SciaRegs.SCIFFRX.bit.RXFIFST !=1) { } // wait for XRDY =1 for empty state
  
       // Check received character
       ReceivedChar = SciaRegs.SCIRXBUF.all;                       
       if(ReceivedChar != SendChar) error(1);

       // Move to the next character and repeat the test
       SendChar++;
       // Limit the character to 8-bits
       SendChar &= 0x00FF;
       LoopCount++;
                         }

}        

         

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top