Hallo,
beschäftige mich gerade mit dem EEProm des Atmega32 und nutze dabei das
AVR GCC Tutorial. Leider habe ich nun ein Problem. Lesen und Schreiben
von Bytes in das EEProm immer in die nächst höhere Adresse ist kein
Problem.
Nun möchte ich aber ein Word nutzen und habe dazu den Quellcode wie
folgt geändert:
1 | #include <avr/io.h>
|
2 | #include <avr/eeprom.h>
|
3 |
|
4 | uint16_t adresse=0;
|
5 | uint16_t wert=0;
|
6 | int test;
|
7 |
|
8 | int main(void)
|
9 | {
|
10 | DDRA=0x00;
|
11 | DDRB=0xff;
|
12 |
|
13 | // Byte aus dem EEPROM lesen
|
14 | uint8_t EEPReadWord(uint16_t addr)
|
15 | {
|
16 | return eeprom_read_word((uint8_t *)addr);
|
17 | }
|
18 |
|
19 | // Byte in das EEPROM schreiben
|
20 | void EEPWriteWord(uint16_t addr, uint16_t val)
|
21 | {
|
22 | eeprom_write_word((uint8_t *)addr, val);
|
23 | }
|
24 |
|
25 |
|
26 | while(1)
|
27 | {
|
28 |
|
29 | if ( PINA & (1<<PINA1))
|
30 | {
|
31 | EEPWriteWord(adresse,wert);
|
32 |
|
33 | wert++;
|
34 | }
|
35 |
|
36 | if ( PINA & (1<<PINA0))
|
37 | {
|
38 |
|
39 | PORTB=EEPReadWord(adresse);
|
40 |
|
41 | adresse++;
|
42 |
|
43 | }
|
44 | }
|
45 | return 0;
|
46 | }
|
Wenn ich nun Debugge mit der Simulation, dann bleibt das Programm beim
schreiben hängen. Im Dissasembly Fenster springt er Programmcursor nun
zwischen den beiden Befehelen hin und her:
00000082 SBIC 0x1C,1 Skip if bit in I/O register cleared
--- No source file
-------------------------------------------------------------
00000083 RJMP PC-0x0001 Relative jump
Was ist in meinem Code falsch?
Und wenn ich z.B. die <avr/eeprom.h> einbinde, wo finde ich dann den
Quellcode mit den Funktionen?