打印

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

[复制链接]
1091|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 | 只看该作者
单步运行看看寄存器的值对不对

使用特权

评论回复
5
zhangmangui| | 2016-11-29 22:08 | 只看该作者
直接参考 controlSUITE里面的例程吧  

使用特权

评论回复
6
小李菜刀| | 2016-11-30 00:16 | 只看该作者
单步调试看看吧。

使用特权

评论回复
7
dzfansman| | 2016-11-30 23:21 | 只看该作者
查看一下 寄存器的配置问题。

使用特权

评论回复
8
dzfansman| | 2016-11-30 23:22 | 只看该作者
检查SCI的写入之后,最好能单步调试。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

121

主题

714

帖子

1

粉丝