Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

【求助】msp430fr5739的FRAM官网读写例程和官方库函数的几个问题

$
0
0

一共有三个问题

首先是官网的例程:

#include <msp430.h>

void FRAMWrite(void);

#define WRITE_SIZE 128
unsigned char count = 0;
unsigned long data;

#if defined(__TI_COMPILER_VERSION__)
#pragma PERSISTENT(FRAM_write)
unsigned long FRAM_write[WRITE_SIZE] = {0};
#elif defined(__IAR_SYSTEMS_ICC__)
__persistent unsigned long FRAM_write[WRITE_SIZE] = {0};
#elif defined(__GNUC__)
unsigned long __attribute__((persistent)) FRAM_write[WRITE_SIZE] = {0};
#else
#error Compiler not supported!
#endif

int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// Configure MCLK for 8MHz operation
CSCTL0_H = 0xA5;
CSCTL1 |= DCOFSEL0 + DCOFSEL1; // Set max. DCO setting
CSCTL2 = SELA_0 + SELS_3 + SELM_3; // ACLK = VLO
CSCTL3 = DIVA_0 + DIVS_1 + DIVM_1; // MCLK = SMCLK = DCO/2

// Turn off temp sensor
REFCTL0 |= REFTCOFF;
REFCTL0 &= ~REFON;

// Turn on LED
P1DIR |= BIT0;
// Initialize dummy data
data = 0x11111111;

while(1)
{
data += 0x00010001;
FRAMWrite(); // Endless loop
count++;
if (count > 100)
{
P1OUT ^= 0x01; // Toggle LED to show 512K bytes
count = 0; // ..have been written
data = 0x00010001;
}

}

}


void FRAMWrite (void)

{
unsigned int i=0;

for ( i= 0; i< WRITE_SIZE; i++)
{
FRAM_write[i] = data;
}

}

问题1.例程并没有出现地址或者指针(或者我没有找到),那么data究竟写在哪里了 

问题2.我要读出存在FRAM中data的值应该如何操作

其次是库函数:

 

void FRAMCtl_memoryFill32 (uint32_t value,
uint32_t *framPtr,
uint16_t count
)
{
while (count> 0)
{
//Write to Fram
*framPtr++ = value;
count--;
}
}

问题3:这个程序中的count是指向FRAM中写了count次value么?写16位数和写32位数FRAM指针变化一样么?


Viewing all articles
Browse latest Browse all 3634

Trending Articles