Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21965

Starterware/MSP430FR6972: the question of using " __persistent"

$
0
0

Part Number:MSP430FR6972

Tool/software: Starterware

Hello, sir

I want to use "__persistent" to initialize variable to FRAM  and stop to the value lose when power supply drop. the code is following

 

__persistent int xx = 0;
__persistent unsigned char cc[10]= {0x0A};
int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop WDT

  P7OUT &= ~BIT0;                           // Clear P7.0 output latch for a defined power-on state
  P7DIR |= BIT0; 
  P7OUT &= ~BIT1;                           // Clear P7.1 output latch for a defined power-on state
  P7DIR |= BIT1; 
  for(unsigned char j= 0; j<10;j++)
  {
     if(cc[j] == j )  
// LED0 blink {P7OUT ^= BIT0;} __delay_cycles(100000); } if(xx == 5) {
//LED1 open P7OUT |= BIT1; } xx =5; for(unsigned char i= 0; i<10;i++ ) { cc[i] = i; } }

After power failure ,I found  that LED0 didn't blink  and LED1 be lighten  when the power supply again . I think the LED0 shoud blink when the power supply again . why?

the content of lnkmsp430fr6972.xcl is:

-Z(CONST)DATA16_P,DATA20_P=7000-FF7F
-Z(DATA)DATA16_HEAP+_DATA16_HEAP_SIZE
-Z(DATA)DATA20_HEAP+_DATA20_HEAP_SIZE


Viewing all articles
Browse latest Browse all 21965

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>