leomecma
Full Member level 5
startup e2prom c18
Hi,
I was having some problems on use ROM qualifier, I need declare a struct, and this struct should be flash resident. I try something like this:
This forms works, but it's reside in RAM:
typedef struct{
byte cod_prod;
byte ano_fabr;
byte sem_fabr;
byte seq_num_h;
byte seq_num_l;
}TEMP_SERIAL;
TEMP_SERIAL serial_number;
void TempWriteSerial (void)
{
serial_number.cod_prod = dataPacket._byte[1];
serial_number.ano_fabr = dataPacket._byte[2];
serial_number.sem_fabr = dataPacket._byte[3];
serial_number.seq_num_h = dataPacket._byte[4];
serial_number.seq_num_l = dataPacket._byte[5];
}
// End RAM
Try to put data in ROM
struct TEMP_SERIAL{
byte cod_prod;
byte ano_fabr;
byte sem_fabr;
byte seq_num_h;
byte seq_num_l;
};
// declare elements of struct type
rom struct TEMP_SERIAL serial_number;
rom struct TEMP_SERIAL *serial_number;
The basic diffence off them are the member acess form "." ou "->" I try the forms below too, but doesn' work, and anyone give error or warnings
rom struct TEMP_SERIAL rom serial_number;
rom struct TEMP_SERIAL rom *serial_number;
I just need received an array of data from USB (dataPacket) and save it on my struct, but I wanna this data lives on ROM, because I need save RAM and this data are configuration data, and changes remotely. Read this configuration data from ROM will be doing sometimes. What's the correct form to do it?
leomecma
leomecma
Hi,
I was having some problems on use ROM qualifier, I need declare a struct, and this struct should be flash resident. I try something like this:
This forms works, but it's reside in RAM:
typedef struct{
byte cod_prod;
byte ano_fabr;
byte sem_fabr;
byte seq_num_h;
byte seq_num_l;
}TEMP_SERIAL;
TEMP_SERIAL serial_number;
void TempWriteSerial (void)
{
serial_number.cod_prod = dataPacket._byte[1];
serial_number.ano_fabr = dataPacket._byte[2];
serial_number.sem_fabr = dataPacket._byte[3];
serial_number.seq_num_h = dataPacket._byte[4];
serial_number.seq_num_l = dataPacket._byte[5];
}
// End RAM
Try to put data in ROM
struct TEMP_SERIAL{
byte cod_prod;
byte ano_fabr;
byte sem_fabr;
byte seq_num_h;
byte seq_num_l;
};
// declare elements of struct type
rom struct TEMP_SERIAL serial_number;
rom struct TEMP_SERIAL *serial_number;
The basic diffence off them are the member acess form "." ou "->" I try the forms below too, but doesn' work, and anyone give error or warnings
rom struct TEMP_SERIAL rom serial_number;
rom struct TEMP_SERIAL rom *serial_number;
I just need received an array of data from USB (dataPacket) and save it on my struct, but I wanna this data lives on ROM, because I need save RAM and this data are configuration data, and changes remotely. Read this configuration data from ROM will be doing sometimes. What's the correct form to do it?
leomecma
leomecma