Storage data on flash of PIC32MX795F512L

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
oekosolve
Posts: 7
Joined: 26 May 2015 09:12

Storage data on flash of PIC32MX795F512L

#1 Post by oekosolve » 04 Jun 2015 12:47

Hello

I'd like to save a history with error conditions in the internal flash from the PIC32MX795F512L
I use the compiler MikroC Pro for PIC32 V3.3.3

In addition I have also found the following commands:
Flash_Write_Word
Flash_Write_Row
Flash_Erase_Page

This function always need a flash address. How do I select them?
In one example of MIKROE I've found that you write to the address 0x9D001000. How is this reserved that I do not overwrite a variable of the rest of the programm.
I have hear a long time ago something like memory allocate but I have not found some idea how I can reserve a definite space of the flash.

I will not write data every seconde. Only if an error occur.

Thank you for your help

Salvatore
Attachments
FLASH.zip
Example from MikroE
(66.64 KiB) Downloaded 161 times

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: Storage data on flash of PIC32MX795F512L

#2 Post by Aleksandar.Mitrovic » 09 Jun 2015 11:08

Hi,

I suggest you to take a look at this post how to allocate your flash memory:
http://www.mikroe.com/forum/viewtopic.p ... te#p216185

Also If you want to know which address are used in your microcontroller I suggest you to take a look at .mlk file of that specific microcontroller.
You can open .mlk file in your compiler by pressing Ctrl+Alt+M buttons.

Best regards,
Aleksandar

oekosolve
Posts: 7
Joined: 26 May 2015 09:12

Re: Storage data on flash of PIC32MX795F512L

#3 Post by oekosolve » 10 Jun 2015 07:28

Thanks you for your help

At the moment I have not the time to show.

I will show as soon as possible and give feedback.

Thanks

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: Storage data on flash of PIC32MX795F512L

#4 Post by Aleksandar.Mitrovic » 10 Jun 2015 08:44

Hi,

I'm expecting your answer.

Best regards,
Aleksadnar

oekosolve
Posts: 7
Joined: 26 May 2015 09:12

Re: Storage data on flash of PIC32MX795F512L

#5 Post by oekosolve » 30 Jun 2015 10:13

Hello

So had time to test your answer

It seems it works with

const long flashvector[512] = {0x00} absolute 0x7D000000;

But if I declarate so it define an array witch contain 0. How I can declarate an array without define the value to a flash address. That I can load every startup the past error's?
Like unsigned int flashvector[length]

If I do write like:
const long flashvector[512] absolute 0x7D000000;

I become the error:
extern can not have absolute flashvector
Pointer required
Invalid statement

Thanks for your help

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: Storage data on flash of PIC32MX795F512L

#6 Post by Aleksandar.Mitrovic » 01 Jul 2015 15:21

Hi,

If you want to use this array to storage some data in, you should declare that array as variable.
In case that you declare your array as constant it will be stored in ROM and you will not be able to change data in this array.

Values of the memory locations should be assigned with some values.

Best regards,
Aleksandar

Post Reply

Return to “User Projects”