1.Description Resource Path Location Type
#10234-D unresolved symbols remain MSP430F6638_TouchPAD C/C++ Problem
2.Description Resource Path Location Type
unresolved symbol itoa, first referenced in ./main.obj MSP430F6638_TouchPAD C/C++ Problem
请问这两个问题是什么情况?是因为我把f5529的HAL_Board.c和.h文件,HAL_Dogs102x6.c和.h文件直接放到6638的工程下面了吗?
这是程序。
#include
#include
#include
#include "msp430.h"
#include "HAL_Board.h"
#include "HAL_Dogs102x6.h"
extern const struct Element element0; //
extern const struct Element element1; //
extern const struct Element element2; //
extern const struct Element element3; //
extern const struct Element element4; //
extern const struct Sensor slider;
#define PI 3.1415926
int sin_table[10]; // 正弦波数组
int *sin_data_pr; // 设立正弦波数组的指针
double i=0;
int j,k;
char flag=1;
int key_table[22]={261,293,329,349,391,440,493,533,587,659,698,783,880,987,
1046,1174,1318,1396,1567,1760,1975};
int period_table[21]; //对应的声音的周期数组
int song_tone_table[24]={4,5,6,7,8};
int key=0;
int m,n;
void main(void)
{
uint8_t turn = 0, quit = 0, i;
struct Element *user;
char turndisp[2];
uint8_t lights[20];
Dogs102x6_clearScreen();
Dogs102x6_stringDraw(0, 0, " Simon Says: ", DOGS102x6_DRAW_NORMAL);
//buttonsPressed = 0;
TI_CAPT_Init_Baseline(&slider); //初始化触摸按键
for(j=0;j<10;j++) //产生正弦波数组
{
i+=PI/5; //360度分10等分 (PI/5)*10=2*PI
sin_table[j]=(int)((sin(i)+1)*2048); //2048是振幅,有一个直流分量2048。
}
sin_data_pr=&sin_table[0]; //指向数组的第一个单元
for(j=0;j<20;j++) //根据音阶的频率计算其周期
{
period_table[j]=(int)(100000/key_table[j]);
}
DAC12_0CTL0 =DAC12IR+ DAC12SREF_1+ DAC12AMP_5+ DAC12ENC+ DAC12CALON+ DAC12OPS;TA1CCTL0 = CCIE; // CCR0 中断使能
TA1CCR0 = period_table[0]; // 定时为第一个音符的音阶周期
TA1CTL = TASSEL_2 + MC_2 + TACLR +TAIE;
for (i = 0; i < 20; i++) lights[i] = 0;
srand(UCSCTL0 + i); //编排随机数发生器e
while (!quit)
{
turn = turn + 1; //每成功一次,动作次数加一
Dogs102x6_stringDraw(1, 0, " MY TURN! ", DOGS102x6_DRAW_NORMAL);
__delay_cycles(11000000);
//根据随机数发生器,系统点亮随机LED
for (i = 0; i < turn; i++)
{
//random number from 0-4, add to Simon array
if (i >= (turn - 1)) lights[i] = rand() % 5;
// Overall delay between button blinks
__delay_cycles(8000000);
//display Simon array according to values 0-4
if (lights[i] == 0)
{
Board_ledOn(LED4);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[0]];
TA1CCTL0&=~CCIE;
//display so lights are slow enough for user to see
__delay_cycles(11000000);
//turn of LED after display
Board_ledOff(LED4);
}
if (lights[i] == 1)
{
Board_ledOn(LED5);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[1]];
TA1CCTL0&=~CCIE;
__delay_cycles(11000000);
Board_ledOff(LED5);
}
if (lights[i] == 2)
{
Board_ledOn(LED6);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[2]];
TA1CCTL0&=~CCIE;
__delay_cycles(11000000);
Board_ledOff(LED6);
}
if (lights[i] == 3)
{
Board_ledOn(LED7);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[3]];
TA1CCTL0&=~CCIE;
__delay_cycles(11000000);
Board_ledOff(LED7);
}
if (lights[i] == 4)
{
Board_ledOn(LED8);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[4]];
TA1CCTL0&=~CCIE;
__delay_cycles(11000000);
Board_ledOff(LED8);
}
}
Dogs102x6_stringDraw(1, 0, " YOUR TURN! ", DOGS102x6_DRAW_NORMAL);
//根据系统点亮LED的顺序,触摸相应触摸按键,并点亮相应LED
for (i = 0; i < turn; i++)
{
// wait for any user input
while ((user = (struct Element *)TI_CAPT_Buttons(&slider)) == 0) ; //等待电容按键被按下
// 关闭所有LED
Board_ledOff(LED4);
Board_ledOff(LED5);
Board_ledOff(LED6);
Board_ledOff(LED7);
Board_ledOff(LED8);
// 将触摸按键输入与系统Simon阵列相比较
if (lights[i] == 0)
{
// 如果正确,点亮相应LED,延迟后关闭
if (user == (struct Element *)&element0)
{
Board_ledOn(LED4);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[0]];
TA1CCTL0&=~CCIE;
// display so lights are slow enough for user to see
__delay_cycles(7000000);
// turn of LED after display
Board_ledOff(LED4);
}
// 如果错误,退出
else
{
quit = 1;
}
}
else if (lights[i] == 1)
{
if (user == (struct Element *)&element1)
{
Board_ledOn(LED5);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[1]];
TA1CCTL0&=~CCIE;
// display so lights are slow enough for user to see
__delay_cycles(7000000);
// turn of LED after display
Board_ledOff(LED5);
}
else
{
quit = 1;
}
}
else if (lights[i] == 2)
{
if (user == (struct Element *)&element2)
{
Board_ledOn(LED6);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[2]];
TA1CCTL0&=~CCIE;
// display so lights are slow enough for user to see
__delay_cycles(7000000);
// turn of LED after display
Board_ledOff(LED6);
}
else
{
quit = 1;
}
}
else if (lights[i] == 3)
{
if (user == (struct Element *)&element3)
{
Board_ledOn(LED7);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[3]];
TA1CCTL0&=~CCIE;
// display so lights are slow enough for user to see
__delay_cycles(7000000);
// turn of LED after display
Board_ledOff(LED7);
}
else
{
quit = 1;
}
}
else if (lights[i] == 4)
{
if (user == (struct Element *)&element4)
{
Board_ledOn(LED8);
TA1CCTL0=CCIE;
TA1CCR0=period_table[song_tone_table[4]];
TA1CCTL0&=~CCIE;
// display so lights are slow enough for user to see
__delay_cycles(7000000);
// turn of LED after display
Board_ledOff(LED8);
}
else
{
quit = 1;
}
}
while ((struct Element *)TI_CAPT_Buttons(&slider) == user) ;
// 如果错误,直接退出
if (quit)
break;
}
//在一次阵列比较中,若触摸按键被按下的顺序,与系统Simon随机阵列的顺序相同,则显示"GOOD JOB!"
if (!quit){
// good job if theyre right
Dogs102x6_stringDraw(1, 0, " GOOD JOB! ", DOGS102x6_DRAW_NORMAL);
__delay_cycles(24000000);
}
}
// 如果错误,显示"WRONG!"
Dogs102x6_stringDraw(1, 0, " WRONG! ", DOGS102x6_DRAW_NORMAL);
__delay_cycles(24000000);
//显示成功次数
Dogs102x6_stringDraw(6, 0, "YOU LASTED ", DOGS102x6_DRAW_NORMAL);
//character from integer for number of turns
itoa(turn, turndisp, 10);
Dogs102x6_stringDrawXY(66, 48, turndisp, DOGS102x6_DRAW_NORMAL);
if (turn > 1) Dogs102x6_stringDraw(7, 0, "TURNS ", DOGS102x6_DRAW_NORMAL);
else Dogs102x6_stringDraw(7, 0, "TURN ", DOGS102x6_DRAW_NORMAL);
__delay_cycles(54000000);
Board_ledOff(LED_ALL);
Dogs102x6_clearScreen();
// buttonDebounce = 1;
}
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void) // 根据特定音符生成对应频率的波形
{
P4OUT ^= BIT1; // Toggle P1.0 LED闪烁
DAC12_0DAT=*sin_data_pr++; //生成的正弦波在 DAC输出
if (sin_data_pr >= &sin_table[10]) //循环输出正弦波
sin_data_pr = &sin_table[0];
DAC12_0DAT &= 0xFFF; // Modulo 4096// 数据保持
TA1CCR0 += period_table[song_tone_table[key]];
//定时器 定时某个音符的音阶周期
}