Part Number: MSP430FR5994
Tool/software: Code Composer Studio
Hello everyone
I have a problem with a Switch Case instruction in combination with the compiler.
This is a code-snippet of the part where the problem occures.
if (uart_getReadFlag())
{
uart_clearReadFlag();
uart_getReceivedData(uartRxData, &nrOfRxBytes);
uartCommand = *uartRxData;
switch (uartCommand)
{
case SET_PULSE_LENGTH:
commandPayload = uartRxData[2] + (uartRxData[1] << 8) ;
heat_setNewPulseLength(commandPayload);
break;
case SET_PERIODE_LENGTH:
commandPayload = uartRxData[2] + (uartRxData[1] << 8) ;
heat_setNewPeriode(commandPayload);
break;
case SET_LOW_VOLTAGE:
heat_setLowVoltage();
break;
case SET_HIGH_VOLTAGE:
heat_setHighVoltage();
break;
default:
break;
}
}
------------------------------------------------------------------------
The function uart_getReadFlag() returns 0 or 1.
If the function returns 1 everything is ok and the correct case is executed. If the function returns 0 the curser (when single stepping in c-file) jumpes to the Switch Statement again. But it doesn't execute any case. After the Switch Statement it leaves the function correctely.
In the disassembly you can see, that the return from function Operation is located after the Switch - Statement. So I think there is a problem by interpreting the Switch Statement correctly. The functionality is correct but when single stepping in the c-file this strange jump to the Switch-Statement, even if the return-value in the if-instruction is zero, doesen't make sence.
So maybe you can help me somehow.
I am using the following Tools:
CCS V7
Compiler Version: TI v16.9.7.LTS
MSP: MSP430FR5994
Thanks for any help!
Dominic