📄 main.c
字号:
#include "Epower_28x.h"
#include "math.h"
/* Define _FLASH mean that it's a flash based program */
//#define _FLASH
/* define the delay_us() function */
extern void DSP28x_usDelay(Uint32 Count);
/* the real time */
Uint16 real_time[8];
int x1228;
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
InitXintf();
// Step 2. Initialize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); // Skipped for this example
ConfigMCLK();
InitSciGpio();
ConfigMcbsp();
ConfigReset();
ConfigSE();
ConfigCAPB();
// ConfigLCD();
RESET_0;
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the 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 DSP281x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
#ifndef _FLASH
// 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 DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();
#else
/* Before initialize flash, we must copy InitFlash() to RAM */
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
InitFlash();
#endif /* #ifndef _FLASH */
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
//PieVectTable.TINT0 = &CpuTimer0Isr;
PieVectTable.MRINTA= &McbspRxFifoIsr;
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
InitCpuTimers(); // For this example, only initialize the Cpu Timers
// Configure CPU-Timer 0 to interrupt every second:
// 150MHz CPU Freq, 1 second Period (in uSeconds)
ConfigCpuTimer(&CpuTimer0, 150, 1000000);
//StartCpuTimer0();
// Step 5. User specific code, enable interrupts:
PieCtrlRegs.PIECRTL.bit.ENPIE = 1; // Enable the PIE block
// Enable TINT0 in the PIE: Group 1 interrupt 7
//PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
// Enable MCBSPRX in the PIE: Group 1 interrupt 6
//PieCtrlRegs.PIEIER6.bit.INTx5 = 1;
// Enable CPU INT1 which is connected to CPU-Timer 0:
//IER |= M_INT1;
// Enable CPU INT2 which is connected to McBSP:
IER |= M_INT6;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
InitCompute();
FFT1024RINIT();
InitScia();
InitEvb();
InitCAPB();
InitMcbspNodlb();
InitMcbsp16bit();
InitMcbspFifo();
RESET_1;
InitAdc73360();
// InitLCD();
EALLOW; // This is needed to write to EALLOW protected registers
GpioMuxRegs.GPBMUX.bit.C6TRIP_GPIOB15 = 0;
GpioMuxRegs.GPBDIR.bit.GPIOB15 = 1;
EDIS; // This is needed to disable write to EALLOW protected registers
EALLOW; // This is needed to write to EALLOW protected registers
GpioMuxRegs.GPFMUX.bit.XF_GPIOF14 = 0;
GpioMuxRegs.GPFDIR.bit.GPIOF14 = 1;
EDIS; // This is needed to disable write to EALLOW protected registers
GpioDataRegs.GPFDAT.bit.GPIOF14 = 0;
// Step 6. IDLE loop. Just sit and loop forever (optional):
/*
InitX1228(); // Initialize the X1228
//WatchDog_Set();
x1228 = Read_Data(CCR_W,SR);
//SetTime(); // Set the time(do this only one time)
*/
// LCDClear();
// DELAY_US(100L);
// Data1Display();
// LCDDisplay();
while(1)
{
//EpowerFFT();
//PowerCompute();
/*
ReadTime();
WatchDog_Restart();
for(i=0;i<8;i++)
{
Scia_Xmit(real_time[i]);
while(ScibRegs.SCIFFTX.bit.TXFFST != 0) ;
DELAY_US(100000L);
}
*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -