Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 495 → Rev 547

/programy/C/avr/tests/ATmega8/blik.c
1,29 → 1,8
/*********************************************
* vim: set sw=8 ts=8 si :
* Author: Guido Socher, Copyright: GPL
* This program is to test the led connected to
* PC5.
* See http://linuxfocus.org/English/November2004/
* for details.
* Chip type : ATMEGA644
* Clock frequency : Internal clock 1 Mhz (factory default)
*********************************************/
#include <avr/io.h>
#include <inttypes.h>
#define F_CPU 1000000UL // 1 MHz
#include <util/delay.h>
 
 
/* compatibilty macros for old style */
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
 
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
 
 
void delay_ms(unsigned int ms)
/* delay for a minimum of <ms> */
{
57,20 → 36,3
return(0);
}
 
 
// // old style now depricated:
// int main(void)
// {
// // enable PC5 as output
// sbi(DDRC,PC5);
// while (1) {
// // led on, pin=0
// cbi(PORTC,PC5);
// delay_ms(500);
// // set output to 5V, LED off
// sbi(PORTC,PC5);
// delay_ms(500);
// }
// return(0);
// }
// // end of old style