We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,there: I have met a tough quesiton, how to program with C and Assembly in the project using KEIL(verison 3.0), for example, I wana program the frame with C, and the functions with assembly, especially for RTC conditions, hope someone to give some advice, great thanks advance!
You want to, or you need to?
What exactly do you hope to gain by mixing C and assembler like that?
When speed is of concern, then you normally move one or more levels of functions totally into assembler - the part where 90+ percent of the execution time is spent.
If you are going to replace all your functions and just keep the skeletons, then it feels better to design from scratch with assembler and macros.
From your post I assume that you are not too familiar with C51 assembly. If this is true then it will be far better for you to stay in the C language. The Keil Compiler/Linker can build better code than you can write in assembly.
If you are more familiar with the C51 assembly language then look into the Keil PK51 User's Guide for instructions how to output C code in assembly language. By selecting the SRC options, Keil will convert your C code to assembly with all the hooks already built. You can then mess up the good C code as you wish.
Bradford
Look for the section titled, "Interfacing C to Assembler" in the C51 Manual...
Thanks so much, there's not much necessary for me to write assembly, it is my interest that forces me to take a deep understanding of the interface of C51 and assembly, I have got the knowlegement that C51 compiler has a great optimize with C code and makes the best resource of the hardware. If I known the interface of C51 and assembly, I could write my C code more efficient, and know the resources used in my project or exploration.
Great thanks. As you mention there, I get more familiar with C programming, yet I have get some basic knowledge of the assembly using core 8051 instructions. Great interest forces me to get deeper understanding to perform C code to assembly and make my C code more efficient, if getting more clear about the interface of C code with assembly, I could write some more assembly or control the compiler do some efficent work as I wish. Do you have any books illustrate this? e-books comes first, great thanks advance!