Control Programming C Structure | Controller Circuit

Wednesday, December 15, 2010

Control Programming C Structure

In every programming of C at a microcontroller must fulfill 4 blocks. In tutorial this microcontroller we will study every category which there must be in every programs writing.

1. Header.

Header comprises include file (.hex) that is library which will be applied in programming. For example:

#include
#include
#include
. . .
2. Data type.

In making of this C program we will make applies Code Vision AVR. Following is tables type variable data which can be applied:

3. Constanta.

Writing of constant in programming of C must follow order under this:

a. Integer or long integer can be written with format denary (example; 1,2,3,4), binary with prefix 0b (example; 0b101001), heksadecimal using prefix 0x (example of 0xff) or oktal by using prefix 0 (example; 0777).

b. Unsigned integer is written with suffix U (example; 10000U).

c. Long integer is written by terminated by L (example of 99L).

d. Unsigned long integer is written by terminated by UL (example of 99UL).

e. Floating point is written by terminated [by] F (example; 1234F).

Character constanta must be written down in quotation mark (example; ' a'), while constanta string must in quotation mark 2 (example; "I learn programming C”).

4. Label, Variable and Function.

Identification of Label, variable, and function cans be in the form of letter (A....Z, a....z) and number (0...9), and character underscore(_). Identified can only be started with letter or character underscore. More important is identifying this Case in significant, that is uppercase and different small. For example, character is variable 1 unlike Variable 1. Identification loads 32 characters.

5. Commentary.

Comments can start with marks ‘/*’ and ending with ‘*/’. For example;

/* this is comment */
/* this comment
Multi line */

Comments at one line can give marks ‘//’. For example;

// this is comment too

To be continued at the next tutorial….

No comments:

Post a Comment