I want to write few assembly instructions during I'm writting a C code for my 89C52 microcontroller. Do you know How? I don't want write another asm file and link it to my C file. thanx
It's all described in the Manual: look-up the SRC, ASM, and ENDASM directives. Note that this will cause your entire 'C' file to be converted to assembler, and you must then pass this to the assembler to generate the object. This means that 1. You lose the 'C'-level source debugging & browsing; 2. 'C' files with the SRC option are re-translated every time you build the project - whether the source has changed or not! Therefore it's usually best to isolate your inline assembler into a very small file - or actually have a separate assembler module!
Thanks, but I'd tested #pragma asm #pragma endasm before, and I could not use it. Do you have any example of using it?
"I could not use it." What happened? Why couldn't you use it? "Do you have any example of using it?" There are examples in the manual You did remember the SRC directive, didn't you...?
//here is a sample of Keil C51 main() { #asm mov a,b #endasm } // and you must set two options about 'SRC..' of this file. To right hit this file in the file tree -->Options for file..
View all questions in Keil forum