Created
May 16, 2019 12:47
-
-
Save avr-programmierung/7717d9fd1ce2f52dbe9b222c8fe0452d to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz Dotmatrix Display 5x7
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 -|--|--|--|--|- | |
* D3 -|--|--|--|--|- | |
* D4 -|--|--|--|--|- | |
* D5 -|--|--|--|--|- | |
* D6 -|--|--|--|--|- | |
* B0 B1 B2 B3 B4 | |
*/ | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define Spalte_1 (PORTB = (1<<PB0)) | |
#define Spalte_2 (PORTB = (1<<PB1)) | |
#define Spalte_3 (PORTB = (1<<PB2)) | |
#define Spalte_4 (PORTB = (1<<PB3)) | |
#define Spalte_5 (PORTB = (1<<PB4)) | |
int main(void) | |
{ | |
DDRB = 0xFF; // Spalten auf Ausgang | |
DDRD = 0xFF; // Zeilen auf Ausgang | |
while(1) | |
{ | |
Spalte_1; | |
PORTD = 0xC1; // 1100 0001 | |
_delay_ms(1); | |
Spalte_2; | |
PORTD = 0xBE; // 1011 1110 | |
_delay_ms(1); | |
Spalte_3; | |
PORTD = 0xBE; // 1011 1110 | |
_delay_ms(1); | |
Spalte_4; | |
PORTD = 0xBE; // 1011 1110 | |
_delay_ms(1); | |
Spalte_5; | |
PORTD = 0xDD; // 1101 1101 | |
_delay_ms(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment