// On TMX samples, to get the best performance of on chip RAM blocks M0/M1/L0/L1/H0 internal
// control registers bit have to be enabled. The bits are in Device emulation registers.
DevEmuRegs.M0RAMDFT = 0x0300;
DevEmuRegs.M1RAMDFT = 0x0300;
DevEmuRegs.L0RAMDFT = 0x0300;
DevEmuRegs.L1RAMDFT = 0x0300;
DevEmuRegs.H0RAMDFT = 0x0300;
// HISPCP/LOSPCP prescale register settings, normally it will be set to default values
SysCtrlRegs.HISPCP.all = 0x0001;
SysCtrlRegs.LOSPCP.all = 0x0002;
// Peripheral clock enables set for the selected peripherals.
SysCtrlRegs.PCLKCR.bit.EVAENCLK=1;
SysCtrlRegs.PCLKCR.bit.EVBENCLK=1;
SysCtrlRegs.PCLKCR.bit.SCIENCLKA=1;
/********************************************************************************
name: int SciaTx_Ready(void)
input: none
output: i 1: ready
0: busy
*********************************************************************************/
int SciaTx_Ready(void)
{
unsigned int i;
if(SciaRegs.SCICTL2.bit.TXRDY == 1)
{
i = 1;
}
else
{
i = 0;
}
return(i);
}
/********************************************************************************
name: int SciaRx_Ready(void)
input: none
output: i 1: new data
0: none
*********************************************************************************/
int SciaRx_Ready(void)
{
unsigned int i;
if(SciaRegs.SCIRXST.bit.RXRDY == 1)
{
i = 1;
}
else
{
i = 0;
}
return(i);
}
3、主程序,SCI采用查询方式实现数据发送接收
#include "DSP28_Device.h"
unsigned int SCiRxData[100];
unsigned int i,j,SendFlag;
void main(void)
{
InitSysCtrl(); //初始化系统