28335 SCI写TXBUF但寄存器里的值没变化

[复制链接]
1398|7
 楼主| Ryze 发表于 2016-11-29 14:26 | 显示全部楼层 |阅读模式
通过while循环不断对SCITXBUF写数据 那么我观察寄存器里的值应该是不断变化的 但是实际运行时寄存器内的值无变化 PC端接受不到数据
#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File

void main(void)
{

  //  Uint16 ReceivedChar;
  //  char *msg;

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

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

// For this example, only init the pins for the SCI-A port.
// This function is found in the DSP2833x_Sci.c file.
   InitScibGpio();

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
   DINT;

// 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();

// 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 DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
   InitPieVectTable();
   ScibRegs.SCICCR.bit.STOPBITS=0;
   ScibRegs.SCICCR.bit.PARITYENA=0;
   ScibRegs.SCICCR.bit.SCICHAR=7;
   ScibRegs.SCICTL1.bit.RXENA=1;
   ScibRegs.SCICTL1.bit.TXENA=1;
   ScibRegs.SCIHBAUD=0X0001;
   ScibRegs.SCILBAUD=0X00E7;
   ScibRegs.SCICTL1.bit.TXWAKE=1;
   ScibRegs.SCICTL1.bit.SWRESET=1;
   ScibRegs.SCITXBUF = 0x2;
   while(1)
           {DELAY_US(200);
            ScibRegs.SCITXBUF=0x5;
            DELAY_US(200);
            ScibRegs.SCITXBUF=0x2;
            DELAY_US(200);
                ScibRegs.SCITXBUF=0x3;
           }
Garen2 发表于 2016-11-29 14:35 | 显示全部楼层
可能是SCI模块初始化不对
尤彼卡 发表于 2016-11-29 14:48 | 显示全部楼层

while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
    ScibRegs.SCITXBUF=0xa;
Stannis 发表于 2016-11-29 15:15 | 显示全部楼层
单步运行看看寄存器的值对不对
zhangmangui 发表于 2016-11-29 22:08 | 显示全部楼层
直接参考 controlSUITE里面的例程吧  
小李菜刀 发表于 2016-11-30 00:16 来自手机 | 显示全部楼层
单步调试看看吧。
dzfansman 发表于 2016-11-30 23:21 | 显示全部楼层
查看一下 寄存器的配置问题。
dzfansman 发表于 2016-11-30 23:22 | 显示全部楼层
检查SCI的写入之后,最好能单步调试。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

121

主题

714

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部