Configuration Wizard for Keil

Source: Internet
Author: User
Tags min
The great features of Keil that were found today will finally be used. Share to everyone. Reproduced.


A preface
Many people use Keil when feeling Keil Configuration Wizard is very magical, especially convenient to use, but do not know how to write their own configuration wizard, in fact, Keil help documents have, Just a lot of people use the feeling of English is inconvenient, or did not understand, for this, close-up a tutorial, I hope you can learn some knowledge.

Two basic introduction

The configuration Wizard can be used only in Keil, and it is possible to set, modify, and configure some preset values through the menu.

Three Basic Use Method

Start writing tags in the document

<<< use Configuration Wizard in Context Menu >>>

When the above keyword is detected, Keil will assume that the document contains a configuration Wizard and start searching for other keywords in the content. Stop the search when the following is detected

<<< End of configuration section >>>

Note: <<< Use the configuration Wizard in Context Menu >>> and <<< end of configuration section >>& Gt Must be "//" shielded or ";". Because the additional information does not affect the compilation of the document, it must be masked, but the mask can not be used in bulk masking such as "/* ...." */, even if "/*" and "* *" are not available on the same line. and "//" or ";" must be at the beginning of the line.

Let's step through this example:

Create a new TEST.C document as a test document.

In the document, enter:

<<< use Configuration Wizard in Context Menu >>>

<<< End of configuration section >>>

Save and close, then open

You can see the options for the configuration Wizard. Click to see the options have come out, but the content is still empty.





Command word

1. Title Command word

We continue to expand our test code:

<<< use Configuration Wizard in Context Menu >>>



<<< End of configuration section >>>



2. Enable group <e> and </e>

Similar to
<<< use Configuration Wizard in Context Menu >>>



<e>this is an options

</e>

<<< End of configuration section >>>

The point here is that <e> is just a single-choice, enable or disable, so here we begin to think how to combine with our program. So I defined a 8bit tmp variable at the back of </e> and assigned his value to 0.

<<< use Configuration Wizard in Context Menu >>>



<e>this is an options

</e>

uint8 tmp = 0;

<<< End of configuration section >>>

When I tick the This was an options,

is automatically turned into a tmp=1:


That's what we want. Configuration menu allows you to change the contents of a compiled C file.

So what if I only want to set one of the TMP, such as the third place.

With the <e.n> command, N represents the first.

Before selecting:

<<< use Configuration Wizard in Context Menu >>>



<e.3>this is an options

</e>



Uint8 tmp=1;



<<< End of configuration section >>>

After selection:

<<< use Configuration Wizard in Context Menu >>>



<e.3>this is an options

</e>



Uint8 tmp=9;



<<< End of configuration section >>>

Let's expand our horizons: Suppose my 8bit data is divided into 8 enable options, what should I do?

<<< use Configuration Wizard in Context Menu >>>



<e.3>this is an options bit 3

</e>

<e.2>this is an options bit 2

</e>

<e.0>this is an options bit 0

</e>



Uint8 tmp=9;



<<< End of configuration section >>>

3.infomations Command <i>

You can display a message when the mouse hovers over the current entry. We continue with the code description:

<<< use Configuration Wizard in Context Menu >>>


<i> Head Start Form here!


<e>this is an options

</e>

<<< End of configuration section >>>

4. Bit Allow <q>

and <e> different,<q> is just a single option, without the concept of paragraph (group).


<i> Head Start Form here!

<q> This is a single bitenable


#define BITENALBE 1

It is also possible to specify a specific


<i> Head Start Form here!

<q.0> This is a single bitenable bit 0

<q.1> This is a single bitenable bit 1

<q.7> This is a single bitenable bit 7


#define BITENALBE 0x83

5.<o> Select or enter a number

<o> This is a 32bit input

UInt32 tmp32=0x2000;

The number of problems involved in digital input is many. For example, I want to limit ah, can only be a certain range ah, what to do.

<min-max>

<o> This is a 32bit input

<2-30>

UInt32 tmp32=0x02;

Can only be selected within the limit value. If you are actively entering a value other than the limit range. That could cause a crash.

<min-max> can also follow a step in the back: <min-max:step&gt, such as:

<o> This is a 32bit input

<2-30:4>

UInt32 tmp32=0x10;

Step into 4, each click on or down, the change of the step is 4



So this number can be made into a drop-down menu. Of course it's possible.

<o> This is a 32bit input

<0=> 1 <1=> 2

UInt32 tmp32=0x01;

When I choose 2, I give 1 to the back of the TMP32.



So specify the location.

Of course, it is also possible.



UInt32 tmp32=0x01;

<o.0> This is a 32bit input bit0

<0=> 1 <1=> 2

UInt32 tmp32=0x01;

<o.0. 7> This is a 32bit input bit0-7

<0=> 1 <1=> 2 <255=> 3

UInt32 Tmp32=0xff;

6. String input <s>



<s> This is a string input

UInt32 buf[]= "Hello";

If you want to limit the length of string input, you can use:<s:limt>

<s.10> This is a string input

UInt32 buf[]= "hello12345";

This basic function is finished, here is a key feature to introduce:

7. Consolidate all the configuration items

We say that there are many configuration items that need to be consolidated. In the process of integration, we must look at a function, that is, how to match multiple configuration items together.

In a paragraph, Keil is only assigning values to the first definition that follows, in order to differentiate between different configuration items in a paragraph, use suffixes to differentiate. above example:


<q.0> This is a single bit enable bit 0

<q1.0> This is a single bit enable bit 0

<o> This is a 32bit input

<2-30:4>

<o1> This is a 32bit input

<0=> 1 <1=> 2

<o2.0> This is a 32bit input bit0

<0=> 1 <1=> 2

<o3.0. 7> This is a 32bit input bit0-7

<0=> 1 <1=> 2 <255=> 3

<s> This is a string input

<s1.10> This is a string input


#define Q0 1

#define Q1 1

UInt32 tmp32=0x15;

UInt32 tmp32=0x00;

UInt32 tmp32=0x01;

UInt32 Tmp32=0xff;

UInt32 buf[]= "Hello";

UInt32 buf[]= "hello12345";

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.