我正在使用BOOSTXL回放作为在MSP430FR5994上运行音频检测代码的参考。 使用的MSP是外部的,并且由启动板成功检测到。 在代码中,我使用开关盒结构在BOOSTXL示例中可用的'默认'和'重新连接'模式之间移动。 我的执行代码如下所示:
void runApplication(void) { while(1) { P5IE &= ~BIT7; // Disable interrupt on P5.7 // vm1010 P5IE &= ~BIT6; // Disable interrupt on P5.6 P5IE &= ~BIT5; // Disable interrupt on P5.5 switch(applicationMode) { case RECORD: { ............... ............... break; default: break; } } // Toggle app mode applicationMode = DEFAULT; P6OUT &= ~BIT1; // vm1010 // Set a Switch debounce to 500ms __delay_cycles(0.01 * __SYSTEM_FREQUENCY_MHZ__); P5IFG &= ~BIT6; // Clear interrupt on P5.6 P5IE |= BIT6; // Enable interrupt on P5.6 P5IFG &= ~BIT5; // Clear interrupt on P5.5 P5IE |= BIT5; // Enable interrupt on P5.5 P5IFG &= ~BIT7; // Clear interrupt on P5.7 // vm1010 P5IE |= BIT7; // Enable interrupt on P5.7 // vm1010 // vm1010 mode pin, o/p, high for WoS mode P6OUT |= BIT1; // vm1010 __bis_SR_register(LPM4_bits + GIE); int16_t spectrum[SIGNAL_ROWS1][SIGNAL_COLS1]; if(FFT_data[1] != 0) { .............. .............. }
在外部MSP上载代码后,当我尝试运行此代码时,程序在检查应用程序的'默认'案例时无法退出LPM4。 我知道发生这种情况的原因是在本例中使用ISR,因为它使用按钮功能退出模式。 ISR的代码如下所示:
#pragma vector=PORT5_VECTOR __interrupt void port5IsrHandler(void) { switch (__even_in_range(P5IV, P5IV_P5IFG7)) { case P5IV_NONE: break; case P5IV_P5IFG0: break; case P5IV_P5IFG1: break; case P5IV_P5IFG2: break; case P5IV_P5IFG3: break; case P5IV_P5IFG4: break; case P5IV_P5IFG5: break; case P5IV_P5IFG6: // Toggle record mode applicationMode = RECORD; //exit LPM mode on exit __bic_SR_register_on_exit(LPM4_bits+GIE); break; case P5IV_P5IFG7: // Toggle record mode applicationMode = RECORD; //exit LPM mode on exit __bic_SR_register_on_exit(LPM4_bits+GIE); break; default: break; } }
但是,我正在使用的外部电路上没有按钮,因此,我需要直接退出LPM4,以便在MSP430执行初始检查后能够记录音频数据。 我正在使用内置调试器评估整个应用程序,在当前情况下-在输入LPM4后使用按钮,允许MSP检查'if'状态,然后进入'RECORE'模式。
虽然我找到了描述使用中断退出LPM的可能性的各种文章,但我不确定如何使它在我的情况下发挥作用,因为我不想在执行过程中更改单个步骤的整个代码的结构。 我还尝试过使用不同ISR的可能性,但这不起作用,因为执行过程中仍涉及按钮功能。
如果需要其他信息,请告诉我,我将尽早回复。