Mutual invocation of Franklin C51 and A51 functions

Source: Internet
Author: User

1 Introduction

C language is a compiler programming language, it takes into account the characteristics of a variety of high-level languages, and can invoke the assembly language subroutine. The design and development of microcontroller program with C language has become an inevitable trend. Franklin C51 is a specialized C development tool for the Intel 8051 series microprocessor, it provides rich library functions, with strong data processing ability, the allocation of 8051 registers and memory in programming is automatically managed by the compiler, therefore, usually use C51 to write main program. However, it is sometimes necessary to invoke some subroutine written in the assembler A51 in the C program. For example, a subroutine written in assembly language before, requiring a higher processing speed, must be written in a more concise assembly language, or some interface program written in a more flexible assembly language due to strict timing requirements. On the other hand, in the process of developing assembly language, if complex mathematical operations are involved, it is often necessary to use the Operation library function provided by C language tool and powerful data processing ability, which requires the C function to be called in the assembly. The content of this paper is to discuss how to implement the C function and the Assembly subroutine in the process of Franklin C51 and A51 programming.

Several main problems involved in the interface of 2 Franklin C51 and A51

Conversion of 2.1 C51 function name and its naming rules

After the C51 program module is compiled into the target file, the function names are converted to different function names according to the nature of their definitions, and therefore, in the invocation of the C and assembler, the assembler must obey the conversion rules of the function name, otherwise, it will be unable to invoke the required function or error. The conversion rules for function names in C51 are shown in table 1.

The naming rules of 2.2 C51 functions and their related segments

A C51 source program module is compiled, in which each function is "? PR? Function name? The naming rule for the name "module name" is assigned to a separate code segment. For example, if the module "FUNC51" contains a function named "Func", then the name of its code segment is "? PR? FUNC? FUNC51 ". If a function contains local variables for data and bit objects, the compiler presses the "? Function name? Byte and? Function name? Bit command rule creates a data and bit segment that represents the starting position of the parameter to be passed, with an offset value of zero. These segments are public, and their addresses can be accessed by other modules. In addition, these segments are given "overlayable" by the compiler, so they can be covered by L51 connection/locator. Depending on the memory mode used, the segment names of these segments are named according to the rules listed in table 2, and when invoked, the assembly language must obey the C51 naming rules for the segment names.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.