Other Parts Discussed in Thread: MSP-EXP430FR6989
Tool/software: Code Composer Studio
Hi TI community,
I have an MSP430FR6989 uc, programming it using MSP-EXP430FR6989 launch pad, and I am using CCS 6.1.0
am doing a simple code, where I create an odometer that counts from 0 to 99,999, and then resets again.
This is my code.
#include <msp430.h> #define DEVELOPMENT 0x5A80 #define ENABLE_PINS 0xFFFE int main(void) { WDTCTL = DEVELOPMENT; PM5CTL0 = ENABLE_PINS;//this is needed in order to enable pins P1DIR = 0x01; P1OUT = 0x00; unsigned int ones, tens, hund, thou, tnth; unsigned long km = 0; while(1) { for(tnth = 0;tnth<10;tnth++) { for(thou = 0;thou<10;thou++) { for(hund = 0;hund<10;hund++) { for(tens = 0;tens<10;tens++) { for(ones = 0; ones<10;ones++) { km = 10000*tnth+1000*thou+100*hund+10*tens+ones; } } } } } P1OUT = ~P1OUT; km = 0; } return 0; }
I added a breakpoint at P1OUT = ~P1OUT
, and pressed the Resume button. (Line 41)
At that line, I see the values of tnth
, thou
, hund
, tens
, and ones
are equal to 10
, which is as expected.
But I also expected km = 99999
, but instead I got km = 34463
. Shouldn't km = 99999.
Also
I modified my code, and changed thnth
, thou
, hund
, tens
, and ones
to signed int
instead of unsigned int
when I Run my program, and it reaches the breakpoint, I see km > 4,000,000,000
Which doesn't make sense.
I believe the problem is with CCS. I searched online, and some people mentioned that CCS is not synchronizing with the microcontroller, if that was the case, how can I fix it.
I would appreciate your help.
Regards,
Forat