How to use ASM into C code compiled by µVision ?
You will find a bunch of examples here: http://www.programmersheaven.com/c/AllSubmissions.asp?UserID=149291
Read the descriptions of ASM, ENDASM, and SRC in the C51 Manual - they include examples. But before this, ask yourself why you want to do such a thing. It is very often an ill-conceived notion. If you need to write assembly, then write an assembly source file and use the assembler to translate it - don't mess about bastardising your 'C'. There has been loads of discussion on this very recently - do a 'Search'
"If you need to write assembly, then write an assembly source file and use the assembler to translate it - don't mess about bastardising your 'C'." For a prime example, see my comments of 4/23/04 7:01:18 in this thread: http://www.keil.com/forum/docs/thread4371.asp The use of inline-assembler in the example caused some useless assembler to be generated, and required adding four lines of useless 'C' whose sole function was to suppress compiler warnings!
I have this error message: error C272: 'asm/endasm' requires src-control to be active Is there something to configure in the compiler for that?
I have this error message: error C272: 'asm/endasm' requires src-control to be active Is there something to configure in the compiler for that? Yes, but do not worry about it. Make your assembly in a separate .A51 module and link it in. ifg you need assembler use assembler, if you do not, use whatever you like. Combining the two in the same module is but a kluge. Erik
In fact, the project I have, compiles with another compiler but I'd to develop my program with Keil software, eg µVision. Can I send you the necessary ".c" & ".h" files in order to test the compilation on your computer? Thank's for advance
I have asm code for more than 1 function... Might I create a ".a51" file for each function? How to link it to the ".c" file? Thank's for advance, Regards
1)I have asm code for more than 1 function... Might I create a ".a51" file for each function? 2) How to link it to the ".c" file? 1) as you like all in one or separate, no difference 2) Brutal answer: with the linker, but you probably ask "how are parametres passed?. Create a 'skeleton' C function mimicking your assembly subroutine. Use the list or use src as a template. Erik
Not so easy to do... Can I send send you my ".c" and ".h" files?
"Is there something to configure in the compiler for that?" Yes, and it is clearly stated in the Manual Go and read the section about ASM/ENDASM in the manual - it tells you clearly & explicitly what to do! It gives you four simple bullet points - just do what it says!
Please tell me which manual you are speaking about... And where to find it? Thx
Well it's not surprising you're having trouble - if you don't even know where the manual is! You need to read the C51 User Guide. You also need to read the uVision Getting Started Guide and work through the example projects in it. ALL the manuals are available in the 'Books' tab of the uVision Project window; or open the PDFs directly: C51.PDF - the Compiler manual; A51.PDF - the Assembler manual; GS51.pdf - the uVision manual.