#ifdef __FLASH_ISP__ /* typedef unsigned int FLADDR; void FLASH_ByteWrite (FLADDR addr, char byte); unsigned char FLASH_ByteRead (FLADDR addr); void FLASH_PageErase (FLADDR addr); void FLASH_Write (FLADDR dest, char *src, unsigned numbytes); char * FLASH_Read (char *dest, FLADDR src, unsigned numbytes); */ void FLASH_ByteWrite (FLADDR addr, char byte) { bit EA_SAVE = EA; // preserve EA char xdata * data pwrite; // FLASH write pointer EA = 0; // disable interrupts #ifdef __NULL_VDM0CN__ // change clock speed to slow, then restore later VDM0CN = 0x80; // enable VDD monitor #endif //RSTSRC = 0x02; // enable VDD monitor as a reset source pwrite = (char xdata *) addr; PSCTL |= 0x01; // PSWE = 1 FLKEY = 0xA5; // Key Sequence 1 FLKEY = 0xF1; // Key Sequence 2 #ifdef __NULL_VDM0CN__ VDM0CN = 0x80; // enable VDD monitor #endif //RSTSRC = 0x02; // enable VDD monitor as a reset source *pwrite = byte; // write the byte PSCTL &= ~0x01; // PSWE = 0 EA = EA_SAVE; // rest