1 | #define F_CPU 4000000
|
2 |
|
3 | #include <avr/io.h>
|
4 | #include <util/delay.h>
|
5 |
|
6 | void enable (void)
|
7 | {
|
8 | PORTD = 0x80;
|
9 | _delay_ms(5);
|
10 | PORTD = 0x00;
|
11 | }
|
12 |
|
13 | void LCDFreigabe (void)
|
14 | {
|
15 | _delay_ms(18);
|
16 | for (unsigned char i=3; i!=0; i--)
|
17 | {
|
18 | PORTB = 0x30;
|
19 | enable ();
|
20 | _delay_ms(18);
|
21 | }
|
22 |
|
23 | PORTB = 0x38; //Funktion Set
|
24 | enable();
|
25 | _delay_ms(2);
|
26 |
|
27 | PORTB = 0x0C; //Display ON/OFF
|
28 | enable();
|
29 | _delay_ms(2);
|
30 |
|
31 | PORTB = 0x01; //Display löschen
|
32 | enable();
|
33 | _delay_ms(2);
|
34 |
|
35 | PORTB = 0x06; //Entry Mode Set
|
36 | enable();
|
37 | _delay_ms(2);
|
38 | }
|
39 | void zeile2(unsigned char zelle)
|
40 | {
|
41 | _delay_ms(2);
|
42 | PORTD = 0x80;
|
43 | PORTB = 0x80+zelle;
|
44 | PORTD = 0x00;
|
45 | _delay_ms(2);
|
46 | }
|
47 |
|
48 | void ausgabe (unsigned char buchstabe)
|
49 | {
|
50 | PORTD = 0xA0;
|
51 | PORTB = buchstabe;
|
52 | PORTD = 0x00;
|
53 | _delay_ms(2);
|
54 | }
|
55 |
|
56 | void Ag (void) { ausgabe(0x41);}
|
57 | void Bg (void) {ausgabe(0x42);}
|
58 | void Cg (void) {ausgabe(0x43);}
|
59 | void Dg (void) {ausgabe(0x44);}
|
60 | void Eg (void) {ausgabe(0x45);}
|
61 | void Fg (void) {ausgabe(0x46);}
|
62 | void Gg (void) {ausgabe(0x47);}
|
63 | void Hg (void) {ausgabe(0x48);}
|
64 | void Ig (void) {ausgabe(0x49);}
|
65 | void Jg (void) {ausgabe(0x4A);}
|
66 | void Kg (void) {ausgabe(0x4B);}
|
67 | void Lg (void) {ausgabe(0x4C);}
|
68 | void Mg (void) {ausgabe(0x4D);}
|
69 | void Ng (void) {ausgabe(0x4E);}
|
70 | void Og (void) {ausgabe(0x4F);}
|
71 | void Pg (void) {ausgabe(0x50);}
|
72 | void Qg (void) {ausgabe(0x51);}
|
73 | void Rg (void) {ausgabe(0x52);}
|
74 | void Sg (void) {ausgabe(0x53);}
|
75 | void Tg (void) {ausgabe(0x54);}
|
76 | void Ug (void) {ausgabe(0x55);}
|
77 | void Vg (void) {ausgabe(0x56);}
|
78 | void Wg (void) {ausgabe(0x57);}
|
79 | void Xg (void) {ausgabe(0x58);}
|
80 | void Yg (void) {ausgabe(0x59);}
|
81 | void Zg (void) {ausgabe(0x5A);}
|
82 | void as (void) {ausgabe(0x61);}
|
83 | void bs (void) {ausgabe(0x62);}
|
84 | void cs (void) {ausgabe(0x63);}
|
85 | void ds (void) {ausgabe(0x64);}
|
86 | void es (void) {ausgabe(0x65);}
|
87 | void fs (void) {ausgabe(0x66);}
|
88 | void gs (void) {ausgabe(0x67);}
|
89 | void hs (void) {ausgabe(0x68);}
|
90 | void is (void) {ausgabe(0x69);}
|
91 | void js (void) {ausgabe(0x6A);}
|
92 | void ks (void) {ausgabe(0x6B);}
|
93 | void ls (void) {ausgabe(0x6C);}
|
94 | void ms (void) {ausgabe(0x6D);}
|
95 | void ns (void) {ausgabe(0x6E);}
|
96 | void os (void) {ausgabe(0x6F);}
|
97 | void ps (void) {ausgabe(0x70);}
|
98 | void qs (void) {ausgabe(0x71);}
|
99 | void rs (void) {ausgabe(0x72);}
|
100 | void ss (void) {ausgabe(0x73);}
|
101 | void ts (void) {ausgabe(0x74);}
|
102 | void us (void) {ausgabe(0x75);}
|
103 | void vs (void) {ausgabe(0x76);}
|
104 | void ws (void) {ausgabe(0x77);}
|
105 | void xs (void) {ausgabe(0x78);}
|
106 | void ys (void) {ausgabe(0x79);}
|
107 | void zs (void) {ausgabe(0x7A);}
|
108 | void ae (void) {ausgabe(0xE1);}
|
109 | void nulln (void) {ausgabe(0x30);}
|
110 | void eins (void) {ausgabe(0x31);}
|
111 | void zwei (void) {ausgabe(0x32);}
|
112 | void drei (void) {ausgabe(0x33);}
|
113 | void vier (void) {ausgabe(0x34);}
|
114 | void fuenf (void) {ausgabe(0x35);}
|
115 | void sechs (void) {ausgabe(0x36);}
|
116 | void sieben (void) {ausgabe(0x37);}
|
117 | void acht (void) {ausgabe(0x38);}
|
118 | void neun (void) {ausgabe(0x39);}
|
119 | void leer (void) {ausgabe(0x20);}
|
120 | void prozent (void) {ausgabe(0x25);}
|
121 | void strich (void) {ausgabe(0x2D);}
|
122 | void doppelpunkt (void) {ausgabe(0x3A);}
|
123 | void punkt (void) {ausgabe(0x2E);}
|