CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Store data in ROM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

Store data in ROM
PostPosted: Fri Feb 11, 2005 6:31 am     Reply with quote

I know there is already a similar topic in the forum, but it didn't really help me.

I am developing a USB mass storage class device using PIC16F877A, compiler version 3.190, MPLAB 7.

I want to store the received data in the ROM memory available in the PIC,
in some chosen locations and retreive the stored data after when needed from these ROM locations.
How can I do it?
How do I choose locations?

Thank you
_________________
Alex
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 11, 2005 6:01 pm     Reply with quote

Quote:

I want to store the received data in the ROM memory available in the
PIC, in some chosen locations and retreive the stored data after when
needed from these ROM locations.
How can I do it?
How do I choose locations?

CCS has an example file for this, called: EX_LOGGER.C

You use an #org statement to preserve an address range in
program memory, so the compiler won't use it.
The #org example in ex_logger.c is overly complex.
In your program, you really probably just need a simple
statement like:
Code:
#org 0x1800, 0x1DFF {}   // Reserve 0x600 words

Then you can use the CCS functions write_program_eeprom()
and read_program_eeprom() to access the memory.

If you're using ICD2 , remember that it loads a "debug executive"
(ie., code) up in high memory in the PIC. For the 16F877A, the
MPLAB vs. 6.42 Help file says the ICD2 uses 0x1F00-0x1FFF.
So don't use that range for your data storage.

Also, the number of times the program memory can be written to
is spec'ed in my 16F877A data sheet at 100K typical, though only 10K
minimum. So if you're going to use it a lot, you should use data eeprom
or external eeprom instead.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Mon Feb 14, 2005 3:14 am     Reply with quote

The EEPROM in the PIC16F877A is just 256 bytes unfortunately.
but I need much more.
So how do I choose locations when using #ORG?
Say, if I need to store 1k bytes.
How do I write and read the data?
_________________
Alex
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group