HC89S003F4 development board to establish assembly project
I. Introduction
There is documentation to achieve ASM & C mixed programming in the supporting information, the establishment of a full project templates compiled according to this method can be derived.
Second, to achieve mixed programming ASM & C
- 1, open Keil project, click Open HC89S003F4.h header file and defined
sfr16 DPTR = 0x82;
block or delete.
- 2, select the need to embed compiled .C file, then right-click and then select
Options For File
in the option box will popGenerate Assembler SRC File
andAssemble SRC File
checked black.
- 3, look at the current project Memory Model, as an example of engineering Small,
- 4, depending on the compilation mode, in KEIL installation directory under the table keil \ c51 \ lib \ in selecting the appropriate library files added to the project.
C51S.LIB - Small model no floating point operations
C51C.LIB - no floating point operations Model Compact
C51L.LIB - no floating point operations Model Large
C51FPS.LIB - Small Model with a floating-point operations
C51FPC.LIB - with floating point operation Model Compact
C51FPL.LIB - Large Model with floating point
add is completed as shown below:
- 5, where the need to embed the assembler added
#pragma asm
and the#pragma endasm
two lines of code written in the corresponding assembler to between two lines of code.
Third, the generated assembly project
- Main.SRC file will be generated in the Project \ Objects folder after compilation, the compiled file the same name as main.asm.
- Adding the project delete main.c main.asm, you can compile.