Library Reference

The Franklin C51 standard library provides you with more than 100 predefined functions and macros to use in your 8051 C programs. This library makes embedded software development easier by providing you with routines that perform common programming tasks such as string and buffer manipulation, data conversion, and floating-point math operations.

Typically, the routines in this library conform to the ANSI C Standard. However, some functions differ slightly in order to take advantage of the features found in the 8051 architecture. For example, the function isdigit returns a bit value as opposed to an int. Where possible, function return types and argument types are adjusted to use the smallest possible data type. In addition, unsigned data types are favored over signed types. These alterations to the standard library provide a maximum of performance while also reducing program size.

All routines in this library are implemented to be independent of and to function using any register bank.

Intrinsic Routines

The C51 compiler supports a number of intrinsic library functions. Non-intrinsic functions generate ACALL or LCALL instructions to perform the library routine. Intrinsic functions generate in-line code to perform the library routine. The in-line code generated is much faster and more efficient than a called routine would be. The following functions are available in intrinsic form:
_crol_ _cror_ _irol_
_iror_ _lrol_ _lror_
_nop_ _testbit_

These routines are described in detail in the following sections.

Library Files

The C51 library includes six different compile-time libraries which are optimized for various functional requirements. These libraries support most of the ANSI C function calls.

Library File

Description

 C51S.LIB

Small model library without floating-point arithmetic

C51FPS.LIB

Small model floating-point arithmetic library

C51C.LIB

Compact model library without floating-point arithmetic

C51FPC.LIB

Compact model floating-point arithmetic library

C51L.LIB

Large model library without floating-point arithmetic

C51FPL.LIB

Large model floating-point arithmetic library

RTXx.LIB

RTX51 multitasking RTOS librarys

80C751.LIB

Library for use with the Signetics 8xC751 and derivatives.

Several library modules are provided in source code form. These routines are used to perform low-level hardware-related I/O for the stream I/O functions. You can find the source for these routines in the \FSI\LIB  directory.  You may modify these source files and substitute them for the library routines. By using these routines, you can quickly adapt the library to perform (using any hardware I/O device available in your target) stream I/O. See the “Stream Input and Output” section for more information.