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
/* | |
* dotmatrix_1.c | |
* ATmega88 @ 8MHz | |
* Dotmatrix Display 5x7 | |
* Zeilen = Kathode | |
* Spalten = Anode | |
* | |
* D0 -|--|--|--|--|- | |
* D1 -|--|--|--|--|- | |
* D2 -|--|--|--|--|- |
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
/* zufallszahlen_01.c | |
* ATmega88 @ 8MHz */ | |
#include | |
#include <avr/io.h> | |
uint16_t zufallszahl, zz, wuerfelzahl, eins=0, zwei=0, drei=0, vier=0, fuenf=0, sechs=0; | |
int main(void) | |
{ | |
for (uint16_t i=0; i<100; i++) // 100 Durchläufe erzeugen |
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
/**************************************************************** | |
* LCD Ausgabe für Hitachi HD44780 kompatible LCD Controller | |
* LCD-Initialisierung: 4-Bit Interface | |
* Mikrocontroller: ATmega88 @ 8MHz | |
* LCD-Display: Displaytech 162B (LCD-Controller KS0070B) | |
* | |
* Konfiguration: PORT D7 = LCD D7 | |
* PORT D6 = LCD D6 | |
* PORT D5 = LCD D5 | |
* PORT D4 = LCD D4 |
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
/* | |
* pointer_01.c | |
*/ | |
#include <avr/io.h> | |
char data; // Datentyp char für Zeichen | |
uint8_t i; | |
void lcd_write(char *t) // *t = Pointer auf übergebenes Zeichen | |
{ |
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
/* display_value wird am PORTB im Multiplexbetrieb ausgegeben | |
* Controller: ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
uint16_t display_value; | |
uint8_t einer, rest, zehner, hunderter; | |
#define T1 0xFE // Transistor 1 = ON (T1 = 11111110) | |
#define T2 0xFD // Transistor 2 = ON (T2 = 11111101) |
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
/* Light_Sensor_ISL29020.c | |
* Lichtmessung (alle 200ms) und Ausgabe der Lichtstärke in Lux in der Variablen "lux_value" | |
* Ein möglicher Übertragungsfehler (ERROR) wird durch eine LED an PB1 angezeigt | |
* CPU: ATmega88, FCPU = 8MHz | |
* I²C CLK Frequency = 62,5kHz, --> CLK Frequency = FCPU/(16 + 2*(TWBR)*Prescaler Value) | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define START 0x08 // A START condition has been transmitted |
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
/* | |
* LM75_Tempsensor.c | |
* Temperaturmessung (5x pro Sekunde) und Ausgabe der Temperatur als Binärwert am PORTD | |
* Eine negative Temperatur wird zusätzlich durch eine LED an PB0 angezeigt | |
* CPU: ATmega88 | |
* FCPU: 8MHz | |
* I²C CLK Frequency = 100kHz, CLK = 8000000/(16 + 2*(0x50)*1) | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> |
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
/* | |
* usart_interrupt_demo_01.c | |
* Funktionen zum Senden und Empfangen eines Bytes per USART-Rx-Interrupt | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/interrupt.h> // Headerdatei für Interrupts einbinden | |
... | |
... | |
void USART_Init( uint16_t ubrr) | |
{ |
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
/* | |
* uart_demo_01.c | |
* Initialisierung der UART, 9600, 8N1; unter Verwendung von Marcos | |
* Funktionen zum Senden und Empfangen eines Bytes im Polling | |
* Ein empfangenes Zeichen wieder senden und am PortB ausgeben * Pinbelegung der UART-Schnittstelle: Tx = PD1, Rx = PD0 | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#define FOSC 8000000 // Set clock Speed in Hz |
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
/* | |
* usi_spi_01.c | |
* Controller: ATtiny44 @ 1MHz | |
*/ | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#include <util/delay.h> | |
void SPI_init(void) // Initialisierung der USI Schnittstelle (SPI Mode) | |
{ |
NewerOlder