28335 SCI写TXBUF但寄存器里的值没变化是什么原因

[复制链接]
1511|20
 楼主| 拉克丝 发表于 2017-5-25 21:38 | 显示全部楼层 |阅读模式
代码如下  通过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;
           }
309030 发表于 2017-5-25 21:48 | 显示全部楼层
可能是你的SCI模块初始化不对,单步执行看看
迪卡 发表于 2017-5-25 22:02 | 显示全部楼层
while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
    ScibRegs.SCITXBUF=0xa;
1988020566 发表于 2017-5-26 22:41 | 显示全部楼层
这个不是连续的写入吗
1988020566 发表于 2017-5-26 22:42 | 显示全部楼层
单步调试每一步骤都能执行吗?
51xlf 发表于 2017-5-29 22:21 | 显示全部楼层
TX_EN?
i1mcu 发表于 2017-5-29 22:21 | 显示全部楼层
往寄存器ScibRegs.SCITXBUF写数据
pmp 发表于 2017-5-29 22:22 | 显示全部楼层
FIFO就会把所要发送的数据都会自动的发送出去
mmbs 发表于 2017-5-29 22:22 | 显示全部楼层
ScibRegs.SCICTL2.bit.TXRDY == 1
1988020566 发表于 2017-5-29 22:23 | 显示全部楼层
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1;
houjiakai 发表于 2017-5-29 22:23 | 显示全部楼层
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1;
cemaj 发表于 2017-5-29 22:24 | 显示全部楼层
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1;
  delay();
youtome 发表于 2017-5-29 22:24 | 显示全部楼层
如果只要中断寄存器配置好, 可以直接进入中断
51xlf 发表于 2017-5-29 22:25 | 显示全部楼层
前加延时试试
i1mcu 发表于 2017-5-29 22:25 | 显示全部楼层
数据不会立刻完成发送的。
pmp 发表于 2017-5-29 22:25 | 显示全部楼层
ScibRegs.SCIFFTX.bit.SCIFFENA=0;
mmbs 发表于 2017-5-29 22:25 | 显示全部楼层
TXRDY == 1 判断当前状态。
1988020566 发表于 2017-5-29 22:25 | 显示全部楼层
在发送中断里清发送中断标志
houjiakai 发表于 2017-5-29 22:25 | 显示全部楼层
若不清fifo发送中断标志则,不进入发送中断
youtome 发表于 2017-5-29 22:25 | 显示全部楼层
FIFO中断数据配置好了?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

150

主题

920

帖子

2

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