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

Find the lowest value in the EEPROM

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



Joined: 03 Aug 2010
Posts: 38

View user's profile Send private message MSN Messenger

Find the lowest value in the EEPROM
PostPosted: Tue Feb 08, 2011 10:13 pm     Reply with quote

I need to find the address of the PIC internal EEPROM, Which contains the Lowest value and I can not write the code. Could you help me get started. Thank you very much. Embarassed
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 08, 2011 10:41 pm     Reply with quote

Use a for() loop to read all the values in the eeprom memory.
This post should give you some ideas of how to do the testing:
http://www.ccsinfo.com/forum/viewtopic.php?t=41229
Pichuqy_1



Joined: 03 Aug 2010
Posts: 38

View user's profile Send private message MSN Messenger

PostPosted: Wed Feb 09, 2011 8:49 pm     Reply with quote

Hi PCM programmer. Thanks for the help. My program was well. If you have any improvements you would appreciate it.
Code:

// This subroutine finds and stores the address of the lowest value in the
// EEPROM area.


void Get_And_Store_Low_Value_Address(void)
{
int direccion,direccion_lowest,z;
float current,lowest;

direccion = 8;               
z=0;


lowest = 0xFFFF;

for(z=0; z<=15; z ++){
 
current = read_float_eeprom(direccion);
 
if(current < lowest){
lowest = current;
direccion_lowest =  direccion;                  }
         
direccion = direccion + 4;
delay_us(50);
}

write_int16_eeprom(72, direccion_lowest);
delay_us(50);
}
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