Control Structure Programming C for ATMega8535 | Controller Circuit

Wednesday, December 15, 2010

Control Structure Programming C for ATMega8535

Writing structures of language C in general is consisted of 4 blocks:

1. Header.

2. Constanta declaration global and or variable.

3. Function and or procedure (this can be written under principal program).

4. Principal program.

In general, programming C was simplest programming to be done with only writes down main program only, that is:

Void main (void)
{
….
}

The full programming done is:

/*HEADER for call library that will used*/
#include
#include

/*Constanta declaration and or global variable */
Unsigned char dt, xx;
Char buf[33];
/* Function declaration and or procedure */
Unsigned char lamp (unsigned char bitn)
{
PORTA=bitn & 0x3C;
}

/*Main program */
Void main (void);
/* Constanta declaration and or local variable */
Char data;
PORTA=0x00;
DDRA=0xF0;

While (1)
{

};

}

No comments:

Post a Comment