my CW debug environment dosnt work around this code, what's the bad? alot of the project code is working but nothing makes sense here. i see the code work on a byte or two sometimes so maybe close. thanks!
//the main.com segment calls these two functions //*********>>> erases the page where of Flash indicated by FlashAddress *********** void Flash_Erase (unsigned int FlashAddress){ FixedAddres = FlashAddress; if(FSTAT &0x10) FSTAT |= 0x10; //write a 1 to FACCERR to clear only if error *(volatile unsigned char *)FixedAddres = 0xFF; //write anything anywhere FCMD = 0x40; //page erase command type. FSTAT |= 0x80; //Put FSTAT/FCBEF = launch a new burst command & wait 4 cycles _asm NOP; _asm NOP; _asm NOP; _asm NOP;
while (!(FSTAT & 0x40)); //else wait for comand to complete }//************************
//*************>>> write byte of data onto the Flash ************** void Flash_Program(Byte data){ if (FSTAT &0x10) FSTAT |= 0x10; //write a 1 to FACCERR to clear