The Role, Generation and Invocation of LIB Libraries in Keil

Click the above The Role, Generation and Invocation of LIB Libraries in Keil “Chuangxue Electronics” to follow with one click, making it easy to learn electronic knowledge.

Chuangxue Electronics Subscription Account

Daily updates on technical articles in the electronics industry and the latest information on microcontrollers, making it easy to learn anytime and anywhere.

What is the use of the LIB library? A simple example is the USBXpress LIB library provided by Silicon Labs for the C8051F microcontroller, which includes functions for sending and receiving USB data that are very versatile. However, due to confidentiality reasons, users do not know how these functions are written; only the API functions are provided, and users can call these functions to complete the corresponding functionalities.

Below, I will demonstrate the generation and invocation of the LIB library using the driver program I developed for the NOKIA5110 LCD.

In the target’s “Options for Target ‘Target1′”, select “Create Library” under output.

The Role, Generation and Invocation of LIB Libraries in Keil

(Here, there can be no main function and some pin definitions, just the NOKIA5110 driver functions).

Click “Rebuild all the target files” to generate the .lib file.

Place the .LIB file generated from the above project into a new folder, and write a program to call the LIB library in this folder. Add the .LIB file to the project, and declare the functions in NOKIA5110.LIB in the project’s header files, so that the main function can call the NOKIA5110 driver functions in the .LIB file.

The Role, Generation and Invocation of LIB Libraries in Keil

LIB library file generation invocation demonstration program (download link): http://www.eeskill.com/file/id/27026.

BTW: The method of calling the USBXpress functions in Keil C is the same as above, but if using the Silicon Laboratories IDE compiler, note that the steps to add the .LIB library are different.

This Silicon Labs IDE is essentially just a shell, and before compiling the program, you need to set the path for calling the Keil compilation core.

Project——Tool Chain Integration

The Role, Generation and Invocation of LIB Libraries in Keil

The Role, Generation and Invocation of LIB Libraries in Keil

The Role, Generation and Invocation of LIB Libraries in Keil

Invocation of LIB library files in Silicon Laboratories IDE

1. Project -> Target Build Configuration -> Customize -> Files to Link -> Add External OBJ

2. In the ‘List files of type’ drop-down box from ‘Object Files’, select ‘All files’ type, and choose the LIB file to add.

3. Click OK.

The Role, Generation and Invocation of LIB Libraries in Keil

> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

How to Share to Moments

Click the upper right corner The Role, Generation and Invocation of LIB Libraries in Keil and select The Role, Generation and Invocation of LIB Libraries in Keil to share to Moments.

How to Follow “Chuangxue Electronics”

1. Click the upper right corner on WeChat “+” and select “Add Friends” → Search for “Chuangxue Electronics” in “Find Official Accounts” to find and follow us. 2. You can also search for the WeChat ID “Chuangxue Electronics” to find and follow us.

How to View Historical Messages

Click the upper right corner icon to enter “Account Information” → “View Historical Messages”.

Chuangxue Electronics Subscription Account

WeChat Name: Chuangxue Electronics updates various knowledge in the electronics industry and the latest information on microcontrollers daily, come and open your visual feast.

Chuangxue Electronics Service Account

WeChat Name: Chuangxue Electronics is a new type of knowledge sharing platform, allowing you to view the latest articles and online videos from Chuangxue Electronics Network, bringing you into the world of electronic engineering technology development learning.

==> Visit www.eeskill.com to learn more!

Leave a Comment