Hi I am new user of 8051 micro controller and keil vision2. I have problem with asm and endasm. I tried the example code for asm/endasm also. But it is giving EMBEDDED_C\ASSEMBLY\ADD.C(8): error C272: 'asm/endasm' requires src-control to be active for
#include <reg51.h> #include <stdio.h> void main(void) { #pragma asm { MOV R0,#07h; MOV R1,#01h; MOV A,R0; ADDC A,R1; MOV A,9000h; } #pragma endasm while(1); }
Go to the C51 Manual and read the descriptions of ASM and ENDASM - they tell you precisely what to do. Be sure to fully read the whole description. Also, do a search here for ENDASM - inline assembler is often not a good way to proceed...
Sample code in C51 Manual is also not working . It is also giving same error.
Are you using the SRC directive? Jon
I am using SRC directive From commandline It is working fine. But I have problem with keilVison2
You say, "I am using SRC directive", but in your original post you said, "it is giving EMBEDDED_C\ASSEMBLY\ADD.C(8): error C272: 'asm/endasm' requires src-control to be active..." This error message is specifically telling you that you have not used the SRC directive! Read the Manual pages again - they give four bullet points telling you precisely what you must do. Follow the four steps precisely and it will work!
Better still, don't use inline assembler! If you have stuff that really needs to be in assembler, then write it in assembler in an assembler source module.
Take a look at the following knoweldgebase article. http://www.keil.com/support/docs/1277.htm Jon