biza 0 Posted April 18, 2020 Share Posted April 18, 2020 hello friends, I am developing a project to school, and I need control a sensor with use a timer, but studying some code, i find a piece of code really similar what i need to do. the problem is inside of interrupt it's is switch code where he call a function "__even_in_range()", this sintaxe only is knowned on the MSP430 plantaform. In MSP432, no is present. So there anyone can help me change the follwing code used in MSP430 to MSP432? Thanks in advance. #pragma vector = TIMER0_A0_VECTOR __interrupt void Timer0_A0_ISR (void) { switch(__even_in_range(TA0IV, TA0IV_TAIFG)) { case TA0IV_NONE: __no_operation(); break; // No interrupt case TA0IV_TACCR1: __no_operation(); break; case TA0IV_TACCR2: __no_operation(); break; case TA0IV_3: __no_operation(); break; // reserved case TA0IV_4: __no_operation(); break; // reserved case TA0IV_5: __no_operation(); break; // reserved case TA0IV_6: __no_operation(); break; // reserved case TA0IV_TAIFG: // overflow TA0CTL &= ~TAIFG; __no_operation(); break; default: __no_operation(); break; } } my doubd is I can change the follwing code: #pragma vector = TIMER0_A0_VECTOR __interrupt void Timer0_A0_ISR (void) { for (MSP432): void TA0_0_IRQHandler(void) { void TA0_0_IRQHandler(void) { but the major problem is: switch(__even_in_range(TA0IV, TA0IV_TAIFG)){ case TA0IV_NONE: __no_operation(); break; // No interrupt Quote Link to post Share on other sites
NurseBob 111 Posted April 18, 2020 Share Posted April 18, 2020 It appears you're working with CCS and based on the device you reference, I'd suggest looking at the "Register Level" code examples in the Simplelink MSP432P4 SDK. (Resource Explorer) The one I found that is likely a good starting place for a simple timer A0 interrupt handler is found in the msp432p401xta0_01 code example for CCS. Quote Link to post Share on other sites
StefanSch 10 Posted April 20, 2020 Share Posted April 20, 2020 __even_in_range is an instrinsic function added for the MSP430 which allows the compiler to generate optimized code using the TAIV register. As it is just used to generate optimized code you can also just leave it away. So use that line: switch(TA0IV) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.