AnsweredAssumed Answered

S12G128 Write to EEPROM

Question asked by Kim Kang-Mok on Oct 17, 2017
Latest reply on Oct 18, 2017 by Kim Kang-Mok

Hi, I want to write to EEPROM in S12G128.

But my CW(Code Warrior) show me the error message (Label 'Send_Command Undefined).

 

This is my code.

 


byte EEPROM_Program(word address, word *ptr, byte number_of_words)
{
word i;

if((number_of_words < 1) || (number_of_words > 4))
return LENGTH_OUT_OF_RANGE;

// check if address is aligned (global address [0] != 0)
if((address & 0x0001) != 0)
return MISALIGEND_ADDRESS;

// check if the word(s) is/are erased
if((EEPROM_Erase_Verify_Section(address, number_of_words)) == NON_ERASED)
return NON_ERASED;

while(FSTAT_CCIF == 0);
FSTAT = 0x30;

FCCOBIX = 0x00;
FCCOB = 0x1100;

FCCOBIX = 0x01;
FCCOB = address;

for(i=1; i<=number_of_words; i++)
{
FCCOBIX = i+1;
FCCOB = *ptr;
ptr++;
}

asm JSR Send_Command;

if((FSTAT & (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0) return ACCESS_ERROR;
if(FSTAT_MGSTAT != 0) return VERIFICATION_FAILED;

return OK;
}

 

What am I forgot something?

Outcomes