2018-08-17 10:57 PM
#include <built_in.h>
unsigned long buff[32];
unsigned long i, tmp,j;
unsigned long Address = 0x08008000;
unsigned long Address2 =0x08000000;
unsigned long* ptr;
void main() {
GPIO_Digital_Output(&GPIOB_BASE, _GPIO_PINMASK_ALL); // digital output PORTB
ptr = (unsigned long*)Address2;
j = *ptr;
GPIOB_ODR = (LoWord(j));
delay_ms(500);
while(1){
j+=1;
if(j>=0xffffff)
j=0;
FLASH_Unlock();
FLASH_ErasePage(Address2); // erase block (Address must be 2048 byte aligned)
FLASH_Write_HalfWord(Address2,j); // write one word
FLASH_Lock();
delay_ms(500);
}
2018-08-18 08:31 AM
Posts lacking context and detail will be ignored. Please learn to formulate a coherent question