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

write_fix_value_external_eeprom

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



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

write_fix_value_external_eeprom
PostPosted: Tue Jun 25, 2013 1:25 am     Reply with quote

Dear all.
I want to write fixed value into external eeprom when programing like command :
Code:
 #rom  int8 0xF00000={0,0}

Can I do this work in CCS C?
my version : 4.140, PIC18F4680, external EEPROM : AT24C04 ( it work well with 2404.c driver of CCS C)
Pls show me way to fix it?
Thanks all.
_________________
Begin Begin Begin !!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Tue Jun 25, 2013 1:58 am     Reply with quote

Of course not.

The external EEPROM, is nothing to do with the PIC.

You need to program it with a hex file of it's own, and using a suitable programmer.
tienchuan



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Jun 25, 2013 3:02 am     Reply with quote

thanks Smile
It was solved by code, but when want to change fixed value, must change code and reprograming.
and here is my code:

1. to write fixed value into ext eeprom:
Code:

      write_ext_eeprom(0,1); 
      write_ext_eeprom(1,0);
      write_ext_eeprom(2,0);


2. change code for the 2nd programing:

Code:

   write_offset=read_ext_eeprom(0);
   printf("\n\r offset n\r", write_offset);
   
   if(write_offset==0)
   {
      write_ext_eeprom(0,1);
      write_ext_eeprom(1,0);
      write_ext_eeprom(2,0);
     
   }
   else
   {
      output_low(PIN_C1);
      output_low(PIN_C2);
      delay_ms(500);
      output_high(PIN_C1);
      output_high(PIN_C2);
   }



Thanks all Smile
_________________
Begin Begin Begin !!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Tue Jun 25, 2013 4:00 am     Reply with quote

Seriously, use an array:
Code:

const int8 eeprom_vals[]={1,0,0}

   int count;
   for (count=0;count<sizeof(eeprom_vals);count++)
       write_ext_eeprom(count,eeprom_vals[count]);
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