从首地址写入16个0xF0 (字节)
1.通过循环的写的方式来实现写入,不知实际有没问题
#include "driverlib.h"
// Address of the beginning of the Flash Information Segment #define SEGSTART 0x1000
void main(void) { // Pointer to beginning of Flash segment uint8_t *flashPtr = (uint8_t *)SEGSTART; uint8_t ch=0xf0; uint8_t *data_ptr; data_ptr=&ch;
uint8_t i; // Stop WDT WDT_hold(WDT_BASE);
// Setting the DCO to use the internal resistor. DCO will be at 16.384MHz CS_setupDCO(CS_INTERNAL_RESISTOR);
// Setting MCLK to DCO / 1. MCLK = 16.384MHz. CS_initClockSignal(CS_MCLK, CS_CLOCK_DIVIDER_1);
// MCLK for Flash Timing Generator // Flash clock will run at ~390kHz. Datasheet recommends 257kHz - 476kHz FlashCtl_setupClock(390095, 16384000, FLASHCTL_MCLK);
FlashCtl_unlockInfo();
for(i=0;i<16;i++) { FlashCtl_write8 (data_ptr, flash_ptr,1) ; flash_ptr++; }
FlashCtl_lockInfo();
while(1) { // Set breakpoint to view memory __no_operation(); } }
直接写入16个 一样的字符型数据
#include "driverlib.h"
// Address of the beginning of the Flash Information Segment #define SEGSTART 0x1000
void main(void) { // Pointer to beginning of Flash segment uint8_t *flashPtr = (uint8_t *)SEGSTART; uint8_t ch=0xf0; uint8_t *data_ptr; data_ptr=&ch;
// Stop WDT WDT_hold(WDT_BASE);
// Setting the DCO to use the internal resistor. DCO will be at 16.384MHz CS_setupDCO(CS_INTERNAL_RESISTOR);
// Setting MCLK to DCO / 1. MCLK = 16.384MHz. CS_initClockSignal(CS_MCLK, CS_CLOCK_DIVIDER_1);
// MCLK for Flash Timing Generator // Flash clock will run at ~390kHz. Datasheet recommends 257kHz - 476kHz FlashCtl_setupClock(390095, 16384000, FLASHCTL_MCLK);
FlashCtl_unlockInfo();
FlashCtl_write8 (data_ptr, flash_ptr,16) ;
FlashCtl_lockInfo();
while(1) { // Set breakpoint to view memory __no_operation(); } }
|