在编译时出现了
Description Resource Path Location Type
.ccsproject /Example_F2802xSci_Echoback line 112, external location: E:\bigschool\thedc\ccs\controlSUITE\device_support\f2802x\v210\F2802x_common\cmd\F2802x_generic_ram.cmd C/C++ Problem
的错误。
描述:新手一个,我在controlsuit的例程Sci_Echoback上进行修改,编译错误,经检查发现将138行(不知道下面的程序在粘贴时有没有出现错误)
kx[0]=55;ky[0]=55;kx[1]=200;ky[1]=55;kx[2]=55;ky[2]=200;kx[3]=200;ky[3]=200;
删除即可编译通过。不明白这是为什么?
---------------------------------------------------
附:例程
#include "f2802x_common/include/adc.h"
#include "f2802x_common/include/clk.h"
#include "f2802x_common/include/flash.h"
#include "f2802x_common/include/gpio.h"
#include "f2802x_common/include/pie.h"
#include "f2802x_common/include/pll.h"
#include "f2802x_common/include/sci.h"
#include "f2802x_common/include/wdog.h"
#include "f2802x_common/include/timer.h"
#include "f2802x_common/include/pwm.h"
// Prototype statements for functions found within this file.
void scia_echoback_init(void);
void scia_fifo_init(void);
void scia_xmit(int a);
void scia_msg(char *msg);
void led();
void toggleled(uint16_t i,uint16_t j);
void xuanzhuan(int x,int y);
void sciread();
short check();
void sciinit();
void taokeng();
void testled();
// Global counts used in this example
uint16_t LoopCount;
uint16_t ErrorCount;
ADC_Handle myAdc;
CLK_Handle myClk;
FLASH_Handle myFlash;
GPIO_Handle myGpio;
PIE_Handle myPie;
SCI_Handle mySci;
TIMER_Handle myTimer;
unsigned char loc,px[4],py[4],ps[4],p_av,p_time,is_over,px1[4],py1[4],nextl,kx[4],ky[4];
void main(void)
{
uint16_t ReceivedChar;
char *msg;
// char msg2[8];
uint32_t i;
uint32_t i2;
CPU_Handle myCpu;
PLL_Handle myPll;
WDOG_Handle myWDog;
// Initialize all the handles needed for this application
myAdc = ADC_init((void *)ADC_BASE_ADDR, sizeof(ADC_Obj));
myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));
myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
mySci = SCI_init((void *)SCIA_BASE_ADDR, sizeof(SCI_Obj));
myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
myTimer = TIMER_init((void *)TIMER0_BASE_ADDR, sizeof(TIMER_Obj));
led();
// Perform basic system initialization
WDOG_disable(myWDog);
CLK_enableAdcClock(myClk);
(*Device_cal)();
CLK_disableAdcClock(myClk);
//Select the internal oscillator 1 as the clock source
CLK_setOscSrc(myClk, CLK_OscSrc_Internal);
// Setup the PLL for x12 /2 which will yield 60Mhz = 10Mhz * 12 / 2
PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2);
// Disable the PIE and all interrupts
PIE_disable(myPie);
PIE_disableAllInts(myPie);
CPU_disableGlobalInts(myCpu);
CPU_clearIntFlags(myCpu);
// If running from flash copy RAM only functions to RAM
#ifdef _FLASH
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
#endif
////////////////////////
//GPIO_setPullUp(myGpio, GPIO_Number_6, GPIO_PullUp_Enable);
GPIO_setLow(myGpio, GPIO_Number_6);
GPIO_setMode(myGpio, GPIO_Number_6, GPIO_6_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_6, GPIO_Direction_Output);
////cap
// GPIO_setPullUp(myGpio, GPIO_Number_7, GPIO_PullUp_Enable);
// GPIO_setHigh(myGpio, GPIO_Number_7);
// GPIO_setMode(myGpio, GPIO_Number_7, GPIO_7_Mode_GeneralPurpose);
// GPIO_setDirection(myGpio, GPIO_Number_7, GPIO_Direction_Output);
/
GPIO_setPullUp(myGpio, GPIO_Number_34, GPIO_PullUp_Disable);
GPIO_setMode(myGpio, GPIO_Number_34, GPIO_34_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_34, GPIO_Direction_Input);
////////////////////////////
// Initalize GPIO
GPIO_setPullUp(myGpio, GPIO_Number_28, GPIO_PullUp_Enable);
GPIO_setPullUp(myGpio, GPIO_Number_29, GPIO_PullUp_Disable);
GPIO_setQualification(myGpio, GPIO_Number_28, GPIO_Qual_ASync);
GPIO_setMode(myGpio, GPIO_Number_28, GPIO_28_Mode_SCIRXDA);
GPIO_setMode(myGpio, GPIO_Number_29, GPIO_29_Mode_SCITXDA);
// Setup a debug vector table and enable the PIE
PIE_setDebugIntVectorTable(myPie);
PIE_enable(myPie);
// Enable global Interrupts and higher priority real-time debug events:
CPU_enableGlobalInts(myCpu);
CPU_enableDebugInt(myCpu);
LoopCount = 0;
ErrorCount = 0;
scia_echoback_init(); // Initalize SCI for echoback
scia_fifo_init(); // Initialize the SCI FIFO
msg = "\r\n\n\nHello World!\0";
scia_msg(msg);
////////////////////////
//
//
//
is_over=0;
i2=1;
kx[0]=55;ky[0]=55;kx[1]=200;ky[1]=55;kx[2]=55;ky[2]=200;kx[3]=200;ky[3]=200;//此处!
for(i=0;i>0;i++){++is_over;}
for(;;)
{
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
GPIO_toggle(myGpio, GPIO_Number_6);
ReceivedChar=GPIO_getData(myGpio, GPIO_Number_6);
scia_xmit('/'); scia_xmit('0'+ReceivedChar);
GPIO_toggle(myGpio, GPIO_Number_0);
GPIO_toggle(myGpio, GPIO_Number_1);
GPIO_toggle(myGpio, GPIO_Number_2);
GPIO_toggle(myGpio, GPIO_Number_3); ReceivedChar = SCI_getData(mySci); scia_msg(msg);
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}ReceivedChar = SCI_getData(mySci); msg="end";scia_msg(msg);
}
}
// Test 1,SCIA DLB, 8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
void scia_echoback_init()
{
CLK_enableSciaClock(myClk);
// 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SCI_disableParity(mySci);
SCI_setNumStopBits(mySci, SCI_NumStopBits_One);
SCI_setCharLength(mySci, SCI_CharLength_8_Bits);
SCI_enableTx(mySci);
SCI_enableRx(mySci);
SCI_enableTxInt(mySci);
SCI_enableRxInt(mySci);
SCI_setBaudRate(mySci, SCI_BaudRate_9_6_kBaud);
// SCI BRR = LSPCLK/(SCI BAUDx8) - 1
/*
#if (CPU_FRQ_60MHZ)
SCI_setBaudRate(mySci, SCI_BaudRate_9_6_kBaud);
#elif (CPU_FRQ_50MHZ)
SCI_setBaudRate(mySci, (SCI_BaudRate_e)162);
#elif (CPU_FRQ_40MHZ)
SCI_setBaudRate(mySci, (SCI_BaudRate_e)129);
#endif
*/
SCI_enable(mySci);
return;
}
// Transmit a character from the SCI
void scia_xmit(int a)
{
// while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
while(SCI_getTxFifoStatus(mySci) != SCI_FifoStatus_Empty){
}
// SciaRegs.SCITXBUF=a;
SCI_putDataBlocking(mySci, a);
}
void scia_msg(char * msg)
{
int i;
i = 0;
while(msg[i] != '\0')
{
scia_xmit(msg[i]);
i++;
}
}
// Initalize the SCI FIFO
void scia_fifo_init()
{
SCI_enableFifoEnh(mySci);
SCI_resetTxFifo(mySci);
SCI_clearTxFifoInt(mySci);
SCI_resetChannels(mySci);
SCI_setTxFifoIntLevel(mySci, SCI_FifoLevel_Empty);
SCI_resetRxFifo(mySci);
SCI_clearRxFifoInt(mySci);
SCI_setRxFifoIntLevel(mySci, SCI_FifoLevel_4_Words);
return;
}
////////////////////////
void led()
{
GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_1, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_2, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_3, GPIO_0_Mode_GeneralPurpose);
GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_1, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_2, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output);
GPIO_setLow(myGpio, GPIO_Number_0);
GPIO_setLow(myGpio, GPIO_Number_1);
GPIO_setLow(myGpio, GPIO_Number_2);
GPIO_setLow(myGpio, GPIO_Number_3);
}
void toggleled(uint16_t i,uint16_t j)
{ scia_xmit('i');
scia_xmit(i);
scia_xmit('j');
scia_xmit(j);
scia_xmit('/');
i=i-'0';j=j-'0';
if (i==0) {if (j==0) GPIO_setLow(myGpio, GPIO_Number_0);else GPIO_setHigh(myGpio,GPIO_Number_0);}
if (i==1) {if (j==0) GPIO_setLow(myGpio, GPIO_Number_1);else GPIO_setHigh(myGpio,GPIO_Number_1);}
if (i==2) {if (j==0) GPIO_setLow(myGpio, GPIO_Number_2);else GPIO_setHigh(myGpio,GPIO_Number_2);}
if (i==3) {if (j==0) GPIO_setLow(myGpio, GPIO_Number_3);else GPIO_setHigh(myGpio,GPIO_Number_3);}
}
void testled()
{
uint16_t k1,k2;
char *msg;
for(;;)
{
msg = "\r\nEnter a character: \0";
scia_msg(msg);
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
k1 = SCI_getData(mySci);
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
k2 = SCI_getData(mySci);
scia_xmit('/');
scia_xmit(k1);
scia_xmit('/');
scia_xmit(k2);
scia_xmit('/');
toggleled(k1,k2);
}
}
void sciread()
{
short i_sciread;
for(;;)
{
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
loc = SCI_getData(mySci);
for(i_sciread=0;i_sciread<3;i_sciread++)
{
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
px[i_sciread] = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
py[i_sciread] = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
px1[i_sciread] = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
py1[i_sciread] = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
ps[i_sciread] = SCI_getData(mySci);
}
while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
p_av = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
p_time = SCI_getData(mySci);while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
is_over = SCI_getData(mySci);
if (check()) sciinit();else break;
}
}
short check()
{while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
LoopCount = SCI_getData(mySci);
if(LoopCount==0x0D)
{while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
LoopCount = SCI_getData(mySci);
if (LoopCount==0x0A) return(0);
}
return(1);
}
void sciinit()
{
for(;;)
{while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
LoopCount = SCI_getData(mySci);
if(LoopCount==0x0D)
{while(SCI_getRxFifoStatus(mySci) < SCI_FifoStatus_1_Word){
}
LoopCount = SCI_getData(mySci);
if (LoopCount==0x0A) break;
}
}
}
//===========================================================================
// No more.
//===========================================================================