Gast
#363049
Hallo
ich habe ein Problem mit einer struct.
Ich habe sie (hoffentlich) global definiert:
/**** eeprom_handling.c begonnen 5.2.06 OR *****/
#include <stdint.h>
#include <stdio.h>
#include <avr/eeprom.h>
#ifndef EEPROM
#define EEPROM _attribute_ ((section (".eeprom")))
#endif
/* Definition der struct und Füllen mit Werten */
struct
{
uint8_t format_delay_control [ 3 ] ;
uint8_t chroma_gain_control [ 3 ];
uint8_t chroma_control [ 3 ];
} eeprom_data = {{ 0x11, 0xBB,0x33 } ,
{ 0x44, 0x55, 0x66 } ,
{ 0x77, 0x88, 0xFF }} ;
eeprom_data.format_delay_control[ 0 ] = 0x00; DIESE ZEILE GIBT DIE
gcc-FEHLERMELDUNG: parse error before '.' token
/* Funktion Schreiben des EEPROMs */
void eeprom_write ( void )
{
eeprom_data.format_delay_control[ 0 ]++ ; DAS GEHT KOMISCHERWEISE !
eeprom_write_block ( &eeprom_data , 0 , sizeof ( eeprom_data ) ) ;
}
/*Funktion Lesen des EEPROMs */ DIE FUNKTIONIERT AUCH !
void eeprom_read ( void )
{
eeprom_read_block ( &eeprom_data , 0 , sizeof ( eeprom_data ) ) ;
for (uint8_t i=0; i < sizeof ( eeprom_data.format_delay_control ); i++)
printf("%X",eeprom_data.format_delay_control[i]) ;
for (uint8_t i=0; i < sizeof ( eeprom_data.chroma_gain_control );
i++) printf("%X",eeprom_data.chroma_gain_control[i]) ;
for (uint8_t i=0; i < sizeof ( eeprom_data.chroma_control ); i++)
printf("%X",eeprom_data.chroma_control[i]) ;
}
ABER WENN ich dann in einer anderen Funktion auf einen Wert aus der
struct zugreifen will, z.B. mit
eeprom_data.format_delay_control[ 0 ]++ ;
BEKOMME ich die Fehlermeldung: 'eeprom_data' undeclared.
Das sieht doch ganz so aus, als wenn die struct nicht global wäre oder
?
Otto
(Danke für die Hilfe )