View previous topic :: View next topic |
Author |
Message |
meysam.za
Joined: 16 Mar 2013 Posts: 7
|
save char on flash memory |
Posted: Sat Jun 08, 2013 4:36 pm |
|
|
hi every body...
i want save char in flash memory like in codevision
flash CHAR m[250];
is any Function or something that i can do that in ccs
flash CHAR m[250];
thanks alot |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Jun 08, 2013 6:32 pm |
|
|
the PIC has EEPROM
and program flash
i suggest EEPROM
its in the CCS manual
under "read_ and write_eeprom() |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat Jun 08, 2013 6:37 pm |
|
|
Don't forget to look up the WRITE ENDURANCE of BOTH. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jun 08, 2013 7:47 pm |
|
|
Quote: | i want save char in flash memory like in codevision
flash CHAR m[250]; |
Do you mean a font table for a graphic lcd ?
If so, see the GLCD.c driver file in the Drivers folder of the CCS compiler.
You can tell the compiler to store a table in Flash by using the 'const' keyword.
Example:
Code: |
const BYTE TEXT[51][5] ={0x00, 0x00, 0x00, 0x00, 0x00, // SPACE
0x00, 0x00, 0x5F, 0x00, 0x00, // !
0x00, 0x03, 0x00, 0x03, 0x00, // "
0x14, 0x3E, 0x14, 0x3E, 0x14, // #
0x24, 0x2A, 0x7F, 0x2A, 0x12, // $
|
|
|
|
meysam.za
Joined: 16 Mar 2013 Posts: 7
|
|
Posted: Sun Jun 09, 2013 3:33 am |
|
|
`pcm programer no const for font ...
i need variable to save sms from GSM modem (sim900) and i must :
char sms[250];
but size of ram is not enogh.....
and i want use flash memory |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sun Jun 09, 2013 4:19 am |
|
|
You can't use flash memory like this....
Flash memory, has a very limited 'write life' (how often you can write to it), and has to be written in pages. To change a single byte, you have to read the whole page, change just the one byte, and write the whole page back. One life used.....
EEPROM is better - supports single byte writes, and has typically tens to hundreds of times the write life of flash, but still quite limited (you can kill the memory in just a few seconds writing as fast as possible).
Both memories are also _slow_. Takes typically 4mSec to perform one write. Too slow to accept something like an SMS message.
Seriously, change your PIC for one with more RAM. This is not what flash memory is designed for. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sun Jun 09, 2013 10:38 am |
|
|
FRAM is even better! _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|