Keil Logo Arm Logo

Discussion Forum

problem with asm and endasm

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
michael john
Posted
28-Jun-2004 13:24 GMT
Toolset
C51
New! problem with asm and endasm
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);
}

 


Please help me how to use asm/endasm properly.
Read-Only
Author
Andrew Neil
Posted
28-Jun-2004 13:49 GMT
Toolset
C51
New! RE: problem with asm and endasm
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...
Read-Only
Author
michael john
Posted
29-Jun-2004 05:44 GMT
Toolset
C51
New! RE: problem with asm and endasm
Sample code in C51 Manual is also not working . It is also giving same error.
Read-Only
Author
Jon Ward
Posted
29-Jun-2004 06:40 GMT
Toolset
C51
New! RE: problem with asm and endasm
Are you using the SRC directive?

Jon
Read-Only
Author
michael john
Posted
29-Jun-2004 07:38 GMT
Toolset
C51
New! RE: problem with asm and endasm
I am using SRC directive
From commandline It is working fine.

But I have problem with keilVison2
Read-Only
Author
Andy Neil
Posted
29-Jun-2004 08:49 GMT
Toolset
C51
New! RE: problem with asm and endasm
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!
Read-Only
Author
Andy Neil
Posted
29-Jun-2004 08:51 GMT
Toolset
C51
New! RE: problem with asm and endasm
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.
Read-Only
Author
Jon Ward
Posted
29-Jun-2004 15:59 GMT
Toolset
C51
New! RE: problem with asm and endasm
Take a look at the following knoweldgebase article.

http://www.keil.com/support/docs/1277.htm

Jon

Next Thread | Thread List | Previous Thread Start a Thread | Settings

arm-logo-small

Keil logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.