Jump to content

Recommended Posts

Hi. I can create and read an array created with the rom char statement. Is it possible to write to this array from within the program to use as a temporary data logging store (before writing to SD card)?

Thanks, David.

Share this post


Link to post
Share on other sites
Hi. I can create and read an array created with the rom char statement. Is it possible to write to this array from within the program to use as a temporary data logging store (before writing to SD card)?

 

Rom objects can't be modified using C. The only option to do this is to use inline assembly (on targets that support run time flash write).

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
Hi. I can create and read an array created with the rom char statement. Is it possible to write to this array from within the program to use as a temporary data logging store (before writing to SD card)?

 

Rom objects can't be modified using C. The only option to do this is to use inline assembly (on targets that support run time flash write).

 

Regards,

Pavel

 

Hi DavidT,

 

Are you talking about the eeprom or the program flash memory? You can store & retrive your array using eeprom_read & eeprom_write function any where in your program.

At this point i am a bit confused with what Pavel has mentioned.

Does the flash_read , flash_loadbuffer, flash_write not work with data flash memory chips when invoked in a c program?

I think i need to know what is what. eeprom?, program memory? or data flash memory?

 

Raghunathan.

Share this post


Link to post
Share on other sites
Hi. I can create and read an array created with the rom char statement. Is it possible to write to this array from within the program to use as a temporary data logging store (before writing to SD card)?

 

Rom objects can't be modified using C. The only option to do this is to use inline assembly (on targets that support run time flash write).

 

Regards,

Pavel

 

Hi DavidT,

 

Are you talking about the eeprom or the program flash memory? You can store & retrive your array using eeprom_read & eeprom_write function any where in your program.

At this point i am a bit confused with what Pavel has mentioned.

Does the flash_read , flash_loadbuffer, flash_write not work with data flash memory chips when invoked in a c program?

I think i need to know what is what. eeprom?, program memory? or data flash memory?

 

The question was about rom data and by definition rom data goes into program memory. By inline assembly I ment TBLxxx instructions of PIC18 that can read/write program memory. I forgot about flash_xxx functions of BoostC :angry: These can be used as well for flash based PIC16 targets.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

SD/MMC cards need 512byte buffers and most 16F's only go to 256 in EEPROM, some 368. So yes, Pavel understood me correctly. I did mean program memory.

 

Thanks for pointing out the flash_ statements. Will these will work with any 'self-write' PIC in the 16F and 18F ranges or only the ones mentioned?

David.

Share this post


Link to post
Share on other sites
SD/MMC cards need 512byte buffers and most 16F's only go to 256 in EEPROM, some 368. So yes, Pavel understood me correctly. I did mean program memory.

 

Thanks for pointing out the flash_ statements. Will these will work with any 'self-write' PIC in the 16F and 18F ranges or only the ones mentioned?

David.

 

Yes, it should work. I have not tried it. The data sheet says that the data EEPROM and Flash program memory is readable & writable during normal operation.

The EEPROM data memory allows single-byte read and write. The flash program memory allows single-word reads and four-word block writes. program memory write operations automatically performs an erase-before write on blocks of four words. A byte write in data EEPROM memory automatically erases the location & writes the new data(erase-before-write).

 

One other aspect while designing would be the erase/ write cycles of your memory.

Typical values of erase/write for PIC16F8xx series is..

 

Flash program memory---100,000 erase/write cycle.

EEPROM--------------------1,000,000 erase/write cycle.

 

I hope you wouldn't exceed the 100,000 cycle of the flash.

 

Regards

 

Raghunathan.

Share this post


Link to post
Share on other sites

Yes, just considering caching options. I'd prefer to avoid a separate memory chip. Some 18F's come with 1024bytes EEPROM which would be perfect. A 16F with 368byte EEPROM + 144bytes as ordinary variables in RAM seems another option. Is data RAM is rated at 1million writes?

Share this post


Link to post
Share on other sites
Yes, just considering caching options. I'd prefer to avoid a separate memory chip. Some 18F's come with 1024bytes EEPROM which would be perfect. A 16F with 368byte EEPROM + 144bytes as ordinary variables in RAM seems another option. Is data RAM is rated at 1million writes?

 

RAM is volatile ie. the data gets erased when power is gone. Not the one you are looking for i guess. external eeprom is the most economical option using I2C interface.

 

Regards

Raghunatahan.

Share this post


Link to post
Share on other sites

Volatile is fine surely for the SD card buffer because it is only a temporary store before writing to the card. I accept this implies that it's OK to loose any data not written to the card when switching it off.

 

I want to minimise external components and the complexity that goes with that. This pushes me towards the 18F range where I can easily get up to 1k EEPROM and over 3k RAM. So I will go this route probably using RAM for caching since it is so much easier and quicker. Thanks for helping me think the options through.

David.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...