Hi,
I am using AT89C51ED2 Micro controller, I want to insert assembly code in between the EEPROM fucntion,
The function is,
void EEPROM_WRITE(unsigned char xdata *Addr,unsigned int E_Data ) { unsigned char Buffer[10],i=0; sprintf(Buffer,"%d",(int)E_Data); while(Buffer[i]!='/0') { while(BUSY); EA=0; E_EEPROM; // EEPROM Enable Macro *(Addr+i)=Buffer[i]; // Replace this code with Assmebly in code??? EA=1; D_EEPROM; // EEPROM Disable Macro i++; } *(Addr+i)='\0'; } }
If there is any problem in the code , please correct !!
and please tell me how can we replace the code in assembly in between the code???
Rajesh
Instead, look up the ASM compiler directive in the C51 manual. The bad news is that this only works when used with the SRC directive, so you need to assemble the resulting source file separately. even better, place the assembly in a separate .a51 module.
Erik
Why would you want to replace just one line of C with assembly?
If you don't like the code that gets generated, you could change the C source. (For example, "*Addr++ = *Buffer++;", or other variations on the theme.)
Or, just replace that section of code with an actual function in assembly and call it.