Can anybody tell me how to combine both C and assembly in Uvision 3? I know something like we have to use SRC directive,asm and endasm for assembly. Suppose i want to perform some addition operation in assembly and i want to print the result using printf statement in C.How to get the register values to C variables?
Do you mean, how to do inline assembler in C51, or how to do a "mixed" project containing both 'C' and assembler source files? The latter is almost invariably preferable to the former...
I want to do a mixed project which includes both C & Assembly source files in one file.
//C style code #pragma asm ; ;assembly code ; #pragma endasm //c style code
"a mixed project which includes both C & Assembly source files in one file." You mean a single Project (eg, PROJECT.UV2) with both 'C' source files (*.C) and assembler source files (*.A51) It's easy: you just add all the files to the uVision Project, and uVision automatically knows to use the Compiler for 'C' source files, and the assembler for assembler files!
http://www.keil.com/support/man/docs/c51/c51_ap_ctoasm.htm
http://www.keil.com/support/man/docs/uv3/uv3_ca_file_extensions.htm
why not use a template as has been suggested ad nauseam "every week" when this issue comes up. Erik