Thread: EEPROM Problem
View Single Post
  #1   Spotlight this post!  
Unread 19-02-2007, 20:04
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
EEPROM Problem

Using Kevin's code, according to tests, either the write or the read is failing. The return from a read operation is 0.

Code:
void Process_Data_From_Master_uP(void)
 {
  static unsigned char i;

  Getdata(&rxdata);   /* Get fresh data from the master microprocessor. */

  /* Remote Program Loading */
  drt_prog_switch = !SW_PROG;

  Default_Routine();  /* Optional.  See below. */

  Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

  EEPROM_Write_Handler();
  Putdata(&txdata);             /* DO NOT CHANGE! */
 }
Code:
/* EEPROM Address Mapping */
#define EEP_ARM_POT_STOWED_LOW   0x0000
#define EEP_ARM_POT_STOWED_HIGH  0x0001
Code:
  ARM_POT_STOWED = EEPROM_Read(EEP_ARM_POT_STOWED_LOW);
  ARM_POT_STOWED += (unsigned int)EEPROM_Read(EEP_ARM_POT_STOWED_HIGH) << 8;
Code:
  if(need_eep_update)
   {
    if(EEPROM_Queue_Free_Space() > 2)
     {
      printf("Updating EEPROM\r\n");
      printf("ARM_POT_STOWED = %i\r\n", ARM_POT_STOWED);
      EEPROM_Write(EEP_ARM_POT_STOWED_LOW,  (byte)(ARM_POT_STOWED & 256));
      EEPROM_Write(EEP_ARM_POT_STOWED_HIGH, (byte)(ARM_POT_STOWED / 256));
      need_eep_update = 0;
     }
   }
Yes, ARM_POT_STOWED is a variable, not a #define, and it is not zero on the write. It is a two byte variable, thus, I split it up into two bytes for the EEPROM.

Need an answer as soon as possible. Thanks in advance.
__________________
Code:
void function(void)
 {
  function();
 }