|
采用MSP430f5529 进行血氧模块的采集以及显示及计算血氧饱和度值。但是数组不能太大,数组长度为50,就不可以了,就无法运行了,应该是内存不够,程序没有报错,可以拷到5529里,但是无法运行,求解决,以下为代码,还有怎么计算血氧饱和度啊。。求助。。
Num_of_Results=50的时候就运行不了了
#include
#include
#include"HAL_DOGS102X6.h"
#include"HAL_Board.h"
#include"HAL_UCS.h"
#include"HAL_PMM.h"
//#include"Control.h"
#include"HAL_Buttons.h"
#define Num_of_Results 8
//volatile x;
volatile float A0results[Num_of_Results];
volatile float A1results[Num_of_Results];
//volatile float Data[1000];
//volatile float A3results[Num_of_Results];
static unsigned int index = 0;
static unsigned int x = 0;
static unsigned int count = 0;
int main(void)
{
// Stop WDT
WDTCTL = WDTPW + WDTHOLD; //关闭看门狗
// Basic GPIO initialization
Board_init(); //初始化GPIO
// Set Vcore to accomodate for max. allowed system speed
SetVCore(3); //设VCore为最大
// Use 32.768kHz XTAL as reference
LFXT_Start(XT1DRIVE_0); //利用LFXT1(32.768kHZ)作为时钟参考
// Set system clock to max (25MHz)
Init_FLL_Settle(25000, 762); //利用FLL(锁频环)将系统时钟设为最大25MHZ
SFRIFG1 = 0; //清中断标志
SFRIE1 |= OFIE; //使能晶振失效中断
// Globally enable interrupts
__enable_interrupt(); //使能全局中断
Dogs102x6_init(); //初始化LCD
Dogs102x6_backlightInit(); //背光初始化
Dogs102x6_setBacklight(11); //设置初始背光值
Dogs102x6_setContrast(11); //设置初始对比度值
Dogs102x6_clearScreen(); //清屏
//-----------方波控制电路-----------------------周期=16s,占空比50%-----------
P1DIR |=BIT0;
P1SEL |=BIT0;
P2DIR |= BIT0+BIT1; // P1.7 output
P2SEL |= BIT0+BIT1; // P1.7 option select
TA1CCTL1 = OUTMOD_3; // CCR0 toggle mode
TA1CCR0 = 32868;
TA1CCR1=100;
TA1CCR2=64736;
TA1CCTL2 = OUTMOD_6;
UCSCTL5 |= DIVA_3;
TA1CTL = TASSEL_1 + MC_2 + TACLR; // ACLK, upmode, clear TAR p2.1=62.66mHz 若没有aclk分频 频率为500mHz
// ACLK=32.768khz/8=4.095khz, upmode, clear TAR
//----------ad------------------------
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_12; // Turn on ADC12, extend sampling time
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_3; // Use sampling timer, repeated sequence
ADC12MCTL0 = ADC12INCH_12; // ref+=AVcc, channel = A0
ADC12MCTL1 = ADC12INCH_13; // ref+=AVcc, channel = A1
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ADC12ENC; // Enable conversions
//MOV R5,#0020H;
ADC12CTL0 |= ADC12SC; // Start convn - software trigger
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
__no_operation(); // For debugger
}
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: break; // Vector 6: ADC12IFG0
case 8: break; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: // Vector 12: ADC12IFG3
A0results[index] = ADC12MEM0; // Move A0 results, IFG is cleared
A1results[index] = ADC12MEM1; // Move A1 results, IFG is cleared
if(x%100==0){
Dogs102x6_pixelDraw(x/100,(A0results[index]/4096)*63*3,0);
Dogs102x6_pixelDraw(x/100,(A1results[index]/4096)*63*3-15,0);
MOV R1,ADC12MEM0;
count++;
}
Dogs102x6_stringDraw(7, 0, "SPO2 ", DOGS102x6_DRAW_INVERT);
x++;
index++; // Increment results index, modulo; Set Breakpoint1 here
if (index ==8)
{
(index = 0);
}
if (x==10300)
{
x=0;
Dogs102x6_clearScreen();
}
break;
case 14: break; // Vector 14: ADC12IFG4
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
}
|
|