Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
495 kaklik 1
/*********************************************
2
* vim: set sw=8 ts=8 si :
3
* Author: Guido Socher, Copyright: GPL 
4
* This program is to test the led connected to
5
* PC5. 
6
* See http://linuxfocus.org/English/November2004/
7
* for details.
8
* Chip type           : ATMEGA644
9
* Clock frequency     : Internal clock 1 Mhz (factory default)
10
*********************************************/
11
#include <avr/io.h>
12
#include <inttypes.h>
13
#define F_CPU 16000000UL  // 8 MHz
14
#include <util/delay.h>
15
 
16
#define LED PINC5
17
 
18
{
19
20
 
21
	// accurate and not so much compiler dependent
22
	// as self made code.
23
	while (ms)
24
	{
25
		_delay_ms(0.96);
26
		ms--;
27
	}
28
}
29
30
 
31
{
32
          /* INITIALIZE */
33
          /* enable PC5 as output */
34
          DDRC|= (1<<LED);
35
36
 
37
	   * This can also be written as _BV(PC5)*/
38
          while (1) {
39
                      /* led on, pin=0 */
40
                      PORTC|= (1<<LED);
41
                      cekej(1000);
42
                      /* set output to 5V, LED off */
43
                      PORTC &= ~(1<<LED);
44
                      cekej(100);
45
	}
46
	  return(0);
47
}
48