完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我的设计是把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++; } } |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于 DSP5509 进行数字图像处理中 Sobel 算子边缘检测的硬件连接电路图
2251 浏览 0 评论
672 浏览 0 评论
普中科技F28335开发板中,如何使用aic23播放由代码生成的正弦波
2684 浏览 0 评论
3453 浏览 1 评论
1186 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 02:17 , Processed in 0.642330 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号