Subversion Repositories svnkaklik

Rev

Rev 495 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 495 Rev 547
Line 1... Line -...
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>
1
#include <avr/io.h>
12
#include <inttypes.h>
2
#include <inttypes.h>
13
#define F_CPU 1000000UL  // 1 MHz
3
#define F_CPU 1000000UL  // 1 MHz
14
#include <util/delay.h>
4
#include <util/delay.h>
15
 
5
 
16
 
-
 
17
/* compatibilty macros for old style */
-
 
18
#ifndef cbi
-
 
19
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
-
 
20
#endif
-
 
21
 
-
 
22
#ifndef sbi
-
 
23
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
-
 
24
#endif
-
 
25
 
-
 
26
 
-
 
27
void delay_ms(unsigned int ms)
6
void delay_ms(unsigned int ms)
28
/* delay for a minimum of <ms> */
7
/* delay for a minimum of <ms> */
29
{
8
{
30
	// we use a calibrated macro. This is more
9
	// we use a calibrated macro. This is more
31
	// accurate and not so much compiler dependent
10
	// accurate and not so much compiler dependent
Line 55... Line 34...
55
                      delay_ms(1000);
34
                      delay_ms(1000);
56
          }
35
          }
57
	  return(0);
36
	  return(0);
58
}
37
}
59
 
38
 
60
 
-
 
61
// // old style now depricated:
-
 
62
// int main(void)
-
 
63
// {
-
 
64
// 	// enable  PC5 as output 
-
 
65
// 	sbi(DDRC,PC5);
-
 
66
// 	while (1) {
-
 
67
// 		// led on, pin=0 
-
 
68
// 		cbi(PORTC,PC5);
-
 
69
// 		delay_ms(500);
-
 
70
// 		// set output to 5V, LED off 
-
 
71
// 		sbi(PORTC,PC5);
-
 
72
// 		delay_ms(500);
-
 
73
// 	}
-
 
74
// 	return(0);
-
 
75
// }
-
 
76
// // end of old style
-