This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef F_CPU | |
#define F_CPU 16000000 | |
#endif | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define BAUD 9600 | |
#define MYUBRR F_CPU/16/BAUD-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
void EEPROM_write(unsigned int uiAddress, unsigned char ucData) { | |
while(EECR & (1 << EEPE)); | |
EEAR = uiAddress; | |
EEDR = ucData; | |
EECR |= 1 << EEMPE; | |
EECR |= 1 << EEPE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chip: atmega16 | |
#include <avr/io.h> | |
void ADC_init() { | |
ADMUX = 1 << REFS0; | |
ADCSRA = 1 << ADEN | 1 << ADSC | 1 << ADATE | 7 << ADPS0; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chip: atmega16 | |
#ifndef F_CPU | |
#define F_CPU 16000000 | |
#endif | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define BAUD 9600 |