No EEPROM in FlowCode ARM v4
Moderator: Benj
No EEPROM in FlowCode ARM v4
I cant find the EEPROM icon in the menu in FlowCode ARM v4. The bitmap picture is in the Component folder "ARM_EEPROM.bmp" but no c-file or ocx file are found there.
Jeppe
Don't say oups!? Say Interesting!
Don't say oups!? Say Interesting!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No EEPROM in FlowCode ARM v4
Hello,
The supported ARM range of devices do not have EEPROM memory as such. You can however read and write from any spare locations in ROM if you desire.
The C functions to do this are as follows.
Pop the code for the functions into the supplementary code window and then reference the functions by using C code icons.
Or modify one of the custom component C files and then you will be able to call the functions without resorting to C icons.
The supported ARM range of devices do not have EEPROM memory as such. You can however read and write from any spare locations in ROM if you desire.
The C functions to do this are as follows.
Code: Select all
char read_register(unsigned int address)
{
char RetVal;
volatile char* register_ptr = (char*)address;
RetVal = *(register_ptr + 0x00200000); //Add SRAM base address to ICD pointer
return RetVal;
}
void write_register(unsigned int address, char data)
{
volatile char* register_ptr = (char*)address;
*(register_ptr + 0x00200000) = data; //Add SRAM base address to ICD pointer
}
Or modify one of the custom component C files and then you will be able to call the functions without resorting to C icons.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: No EEPROM in FlowCode ARM v4
Tanks!
Think I'm little to much newbie in C (the reason I choose FC) to figure out how to implement those functions. A simple (if there are one) sample code would help me.
Think I'm little to much newbie in C (the reason I choose FC) to figure out how to implement those functions. A simple (if there are one) sample code would help me.
Jeppe
Don't say oups!? Say Interesting!
Don't say oups!? Say Interesting!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No EEPROM in FlowCode ARM v4
Hello,
Here is the code in the form of a custom component. Copy the C file into your "Flowcode ARM v4/Components" directory before starting Flowcode. Then add the Custom2 component to your program and you should gain access to the functions. Remember that the functions share the program memory space so be careful about which addresses you choose.
Here is the code in the form of a custom component. Copy the C file into your "Flowcode ARM v4/Components" directory before starting Flowcode. Then add the Custom2 component to your program and you should gain access to the functions. Remember that the functions share the program memory space so be careful about which addresses you choose.
- Attachments
-
- ARM_Custom2.c
- (4.03 KiB) Downloaded 251 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: No EEPROM in FlowCode ARM v4
I't seems to work except the write function. Can't get it to change the value in an address. Every time I read I get the value of (byte)147. I tried many different addresses but still the same value. I attached the program I made to test the function. Am I doing something wrong?
- Attachments
-
- mem.fcf_arm
- (9 KiB) Downloaded 223 times
Jeppe
Don't say oups!? Say Interesting!
Don't say oups!? Say Interesting!
Re: No EEPROM in FlowCode ARM v4
Got it to work now. Don't know what I did wrong.
If I want the data to stay in the memory after power loss. So I can re-read the last stored values up on restart.
If I want the data to stay in the memory after power loss. So I can re-read the last stored values up on restart.
Jeppe
Don't say oups!? Say Interesting!
Don't say oups!? Say Interesting!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No EEPROM in FlowCode ARM v4
Great, glad its working for you now. Data you store in the ROM should be retained during a power cycle.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel