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
/* spi_flash_02.c | |
* SPI-Kommunikation mit Flash-Speicher SST25VF016B | |
* 1.) Statusregister lesen | |
* 2.) Ein Byte auf Adresse 000101 schreiben | |
* 3.) Ein Byte von Adresse 000101 lesen | |
* 4.) Kompletten Flashspeicher löschen | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#define WP (1<<PC5) // Write Protect disable @PC5 |
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
/* spi_flash_01.c | |
* SPI-Kommunikation mit Flash-Speicher SST25VF016B und Auslesen des Statusregisters | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#define WP (1<<PC5) // Write Protect disable @ PC5 | |
#define HOLD (1<<PC4) // Stop serial communication disable @ PC4 | |
#define CE (1<<PB2) // Chip Enable @ PB2 | |
#define MOSI (1<<PB3) // Master Out Slave In @ PB3 | |
#define MISO (1<<PB4) // Master In Slave Out @ PB4 |
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
/* | |
* spi_receive_02.c | |
* SPI-Slave - Daten am MOSI per Interrupt Anforderung empfangen und am PORTD ausgeben | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#include <util/delay.h> | |
void SPI_Slave_Init(void) |
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
/* * spi_receive_01.c | |
* SPI-Slave - Daten am MOSI empfangen und am PORTD ausgeben | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
void SPI_Slave_Init(void) | |
{ | |
SPCR &= ~(1<<MSTR); // Controller = Slave |
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
/* | |
* spi_send_01.c | |
* SPI-Master - Datenübertragung | |
* Übertragung zweier 8-Bit Daten (11010010 und 10000001) | |
* Controller: ATmega88 @ 1MHz | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
void SPI_Master_Init(void) |
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
/* | |
* LED_fading_04.c | |
* with 10bit valuetable and phasecorrect pwm | |
* Controller: ATmega88 @ 1MHz | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define button_down (!(PIND & (1<<PIND2))) | |
#define button_up (PIND & (1<<PIND2)) |
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
/* | |
* LED_fading_03.c | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#include // Einbinden der Headerdatei math.h für mathematische Funktionen | |
int main(void) | |
{ |
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
/* | |
* LED_fading_02.c | |
* with 10bit valuetable and phasecorrect pwm | |
* Controller: ATmega88 @ 8MHz | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
const unsigned int pwm_table_10[64] = |
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
/* LED_fading_01.c ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
int main(void) | |
{ | |
DDRB |= (1<<PB1); // OC1A = output | |
ICR1 = 1000; // Top Value = 1000 | |
OCR1A = 750; // Compare Match bei 750 | |
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
/* pwm_phasecorrect_01.c ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
int main(void) | |
{ | |
DDRB |= (1<<PB1); // OC1A = Ausgang | |
ICR1 = 1000; // ICR = Top Wert bei 1000 | |
OCR1A = 750; // Compare Match für OC1A bei 500 | |
// Mode 10: PWM, Phase Correct, Prescaler = 8, Clear OC1A on compare match |