
How to store a nr on a 18f46j50
Moderator: Benj
- 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: How to store a nr on a 18f46j50
Hello,
On newer devices like this Microchip got rid of the EEPROM peripheral and simply replaced it with the functionality to read and write the ROM flash directly. This means you can assign some or all of your spare ROM to storing data in a none volatile format.
Flowcode currently does not support this feature directly but you should be able to perform this functionality by creating a macro to read a byte from a certain address and a macro to write a byte to an address. The actual reading and writing would have to be performed by C code which you should be able to get hold of.
I think this has been done before on the forums so I would start by searching here and see if you can find anything useful.
Let us know how your getting on.
On newer devices like this Microchip got rid of the EEPROM peripheral and simply replaced it with the functionality to read and write the ROM flash directly. This means you can assign some or all of your spare ROM to storing data in a none volatile format.
Flowcode currently does not support this feature directly but you should be able to perform this functionality by creating a macro to read a byte from a certain address and a macro to write a byte to an address. The actual reading and writing would have to be performed by C code which you should be able to get hold of.
I think this has been done before on the forums so I would start by searching here and see if you can find anything useful.
Let us know how your getting on.
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
- 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: How to store a nr on a 18f46j50
This might be useful as it explains how it is done as well as the caveats such as having to erase the flash a page at a time.
http://ww1.microchip.com/downloads/en/a ... 01095c.pdf
http://ww1.microchip.com/downloads/en/a ... 01095c.pdf
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
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Re: How to store a nr on a 18f46j50
Hi Benj
I need to make a program were I can enter and save cell nr's.
Do you know if anyone managed to use flash like normal eeprom with flowcode?
I've searched the forums without success and my poor C programming skills are not helping either
Will it be possible to use a c-block and write the code in asm from the data sheet samples? (my asm skills are a bit better the my C-skills)
I need to make a program were I can enter and save cell nr's.
Do you know if anyone managed to use flash like normal eeprom with flowcode?
I've searched the forums without success and my poor C programming skills are not helping either


Will it be possible to use a c-block and write the code in asm from the data sheet samples? (my asm skills are a bit better the my C-skills)
-
- Flowcode v5 User
- Posts: 211
- Joined: Tue Feb 19, 2013 9:51 pm
- Has thanked: 72 times
- Been thanked: 177 times
Re: How to store a nr on a 18f46j50
I made some Flowcode V5 flash memory macros to be used on some 12 and 16 series devices. You can't use flash memory like eeprom. First you need make sure the address you want to write to has been previously erased. Then you can write your data. If you need to erase it, you have to erase an entire row. If there is any data you need to keep that is in that row you have to copy it to ram before you erase it and then rewrite it. Also, flash rom's endurance is lower than eeprom so you have to be careful how many times you do this to a certain row. There might be an easy solution if you don't need to do lots of rewrites. If your device programmer erases all the flash memory locations during programming you can just write to sequential locations without having to deal with erase in your code. The link above that Benj posted seems to aleviate some of the issues if you want to use that concept. There is almost always example asm code in the data sheets for you to use as a guide to create your own Flowcode macros in asm if you like. You also have the option to use an external eeprom since V5 Pro has communication component macros built-in. Here is the link if you want to experiment with the flash memory macros but, I have no idea if they will work on 18 series micros since I don't use them.
http://www.matrixmultimedia.com/mmforum ... ory#p57004
http://www.matrixmultimedia.com/mmforum ... ory#p57004