Page 1 of 1

Adding memory to MIAC

Posted: Thu Jul 28, 2011 9:22 am
by Markro
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...

Re: Adding memory to MIAC

Posted: Thu Jul 28, 2011 9:41 am
by Steve
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.

Re: Adding memory to MIAC

Posted: Thu Jul 28, 2011 4:45 pm
by Markro
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 ).

Re: Adding memory to MIAC

Posted: Thu Jul 28, 2011 5:12 pm
by Benj
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: Select all

	char read_register(unsigned int address);
	void write_register(unsigned int address, char data);
Code Section

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;
	}

Re: Adding memory to MIAC

Posted: Tue Aug 02, 2011 4:38 pm
by icare34
Hello,
I have used the "Misc"/ "EEPROM" with Flowcode 4.
With this, we can write ans read the MIAC EEPROM.
Best Regards