Keil uVision v3.62 (8051) 사용중입니다. demo version이구요2KB Size limit 에는 해당이 않되는데 inline assembler이 지원이 않되는 군요
unsigned char iap_write(unsigned int address,unsigned char Data){ unsigned char i = 0; unsigned char Write_data = 0; //void (*prog)(void);
//prog = 0xff0a;
for(i=0; i<2; i++) //loop for verify { #pragma asm push ACC //; backup ACC, DPTR push DPL push DPH #pragma endasm;
DPL = address & 0xff; // Setting writing address DPH = ((address & 0xff00)>>8); ACC = Data; // Setting writing data
EEAEN |= 0x01; // IAP routine access enable EECNTM = EEP_M_VAL; EECNTL = EEP_L_VAL; EECNTLD = 0x80; // Time load // (*prog)(); #pragma asm lcall iap_eeprom_program ; call IAP programming #pragma endasm EEAEN &= 0xFE; // IAP routine access diable #pragma asm clr A movc A, @A + DPTR #pragma endasm
Write_data = ACC;
#pragma asm pop DPH pop DPL pop ACC #pragma endasm
if(Write_data == Data) break; } return Write_data;}
이구문을 C 프로그램 내에 끼워 넣어야 되는데 Demo version에서는 지원 하지 않는 답니다. 경험이 있으신분 도와주세요
unsigned char iap_write(unsigned int address,unsigned char Data){ unsigned char i = 0; unsigned char Write_data = 0; //void (*prog)(void);
//prog = 0xff0a;
for(i=0; i<2; i++) //loop for verify { #pragma asm push ACC //; backup ACC, DPTR push DPL push DPH #pragma endasm;
DPL = address & 0xff; // Setting writing address DPH = ((address & 0xff00)>>8); ACC = Data; // Setting writing data
EEAEN |= 0x01; // IAP routine access enable EECNTM = EEP_M_VAL; EECNTL = EEP_L_VAL; EECNTLD = 0x80; // Time load // (*prog)(); #pragma asm lcall iap_eeprom_program ; call IAP programming #pragma endasm EEAEN &= 0xFE; // IAP routine access diable #pragma asm clr A movc A, @A + DPTR #pragma endasm
Write_data = ACC;
#pragma asm pop DPH pop DPL pop ACC #pragma endasm
if(Write_data == Data) break; } return Write_data;}
이구문을 C 프로그램 내에 끼워 넣어야 되는데 Demo version에서는 지원 하지 않는 답니다. 경험이 있으신분 도와주세요