Yikes! Hopefully you can help me with this.
I am using CCS 5, MSP430 Compiler 4.0.1
I used default basic project generation to get a basic project.
I am trying to do a simple calculation where a multiplication gets skipped over in the debugger.
In the code below both the line
lsrOH = lsrOH * 3; // debugger skips over this line - I have tried many variations with same results
slotTime = 18.0/40000. + (float) lsrOH; // trying to calculate a float value and value is garbage when looked at in the debugger
#include <msp430f5438.h>
void main(void) {
int maxRepeats = 3;
unsigned int value;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
value = test(maxRepeats,1,2);
printf("%d",value);
}
unsigned int test(unsigned int maxRepeats, unsigned int testB, unsigned int testC)
{
unsigned int lsrOH;
float slotTime;
lsrOH = (maxRepeats + 1);
lsrOH = lsrOH * 3;
slotTime = 18.0/40000. + (float) lsrOH;
return (unsigned int) slotTime * 1000;
}