Hi, Thanks for the information. Yes its not working for the Full Chip Simulation in Code Warrior.
Yes i have board with me of Freescale . When i m trying to flash the code thru code warrior it is asking me to erase the non volatile memory for FLASH and EEPROM.which is done by debugger.
But if u check the security state of the MCU is unsecured as it is mention in document before doing any operation on EEPROM or FLASH the MCU should be in unsecured state. That is to be checked by the FSEC register in FLASH.
After performing this activity i m flashing my program to program the word in EEPROM as mention below. i have one query regarding the address. Like when u select the small memory model you are able to access only 1k. which is 0x0C00 TO 0x0FFB; and as per the spec of HCS12X512 the default page would be FE.
I have try to gave the logical address as per the code warrior file .prm but not able to program the word in EEPROM.pls reply if anybody knows.
/*local variable to store the data.*/
uint32 l_ulvalue;
/*pointer and variable to store the address.*/
uint32 l_ulEepAdd;
uint32 l_ulptr;
/*Code*/
/*Test Program to write into the EEPROM.*/
/*write an appropriate value to ECLKDIV register as per the MCU bus clock is 2MHz..*/
ECLKDIV = 0x15;
l_ulvalue = 0x55AA;
/*take the address from the non paged EEPROM for small memeory model.*/
l_ulEepAdd = 0x0D00;
l_ulptr = &l_uladdress;
if(ESTAT_CBEIF == 0x01)
{
*l_ulptr = l_ulvalue;
ECMD = 0x20;
ESTAT = 0x80;
if((ESTAT_ACCERR|ESTAT_PVIOL) !=0)
{
/*fail.*/
}
while(ESTAT_CCIF != 0x01);
}
else
{
/*fail.*/
}