Hi,
Am wondering if it is possible to add memory to the MIAC and what would be the best suggested approach.
I plan on using the MIAC as a CAN node, however this could require a lot of data. e.g a mutiplexed CAN frame which sends out configuration data. I know at least 1 of the total 'file' sizes is 252 bytes - so thats the eeprom used up. And that does not allow for configuration of any other parameters in other CAN frames which would be used. As the goal is that this data could change on a application basis then it would need to be able to be updatable - I am thinking at the minute through a PC program writing to the configuration space.
My goal is to try and make the program as flexible as possible, by entensive use of configuration values.
I suppose there is flash but not sure how large the program would be yet...
Adding memory to MIAC
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Adding memory to MIAC
The chip used by the MIAC is the 18F4455. This device has the facility to "self program" itself - i.e. you can essentially use the program memory space in the same way you would use an EEPROM.
You would need to write the code to do this in C or ASM and embed this into your program. You might also need to make a certain area of memory as "data memory" so that you did not accidentally overwrite your actual program.
You would need to write the code to do this in C or ASM and embed this into your program. You might also need to make a certain area of memory as "data memory" so that you did not accidentally overwrite your actual program.
Re: Adding memory to MIAC
Are there any tutorials for this kind of usage.
Topics I need to understand:
1) How to implement this kind of memory management within the Flowcode environment.
2) How to keep track of my data - Presume I need to prescribe the locations to which the data is read and will be stored.
3) Reading the data from this 'data memory' area - I guess the reading is not too hard, it is the locating.
4) How to write to this area using some PC based application.
5) Are there restictions on the usage of PPP ? i.e. can it be integrated into a PC app which would read out the current data area and then allow modification and writing back of the new data ( using MIAC UI would be too cumbersome ).
Topics I need to understand:
1) How to implement this kind of memory management within the Flowcode environment.
2) How to keep track of my data - Presume I need to prescribe the locations to which the data is read and will be stored.
3) Reading the data from this 'data memory' area - I guess the reading is not too hard, it is the locating.
4) How to write to this area using some PC based application.
5) Are there restictions on the usage of PPP ? i.e. can it be integrated into a PC app which would read out the current data area and then allow modification and writing back of the new data ( using MIAC UI would be too cumbersome ).
- 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: Adding memory to MIAC
Hello,
You can add these C functions to the Supplementary code window (view -. project options -> Supp code) and then reference the functions using C code icons.
Defines Section
Code Section
You can add these C functions to the Supplementary code window (view -. project options -> Supp code) and then reference the functions using C code icons.
Defines Section
Code: Select all
char read_register(unsigned int address);
void write_register(unsigned int address, char data);
Code: Select all
char read_register(unsigned int address)
{
char RetVal;
volatile char* register_ptr = (char*)address;
RetVal = *register_ptr;
return RetVal;
}
void write_register(unsigned int address, char data)
{
volatile char* register_ptr = (char*)address;
*register_ptr = data;
}
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: Adding memory to MIAC
Hello,
I have used the "Misc"/ "EEPROM" with Flowcode 4.
With this, we can write ans read the MIAC EEPROM.
Best Regards
I have used the "Misc"/ "EEPROM" with Flowcode 4.
With this, we can write ans read the MIAC EEPROM.
Best Regards