Moderadores: 51, guest2003, brasilma
#include <mega8.h>
eeprom char var;
void main ( void )
{
char var_local;
var = 0xFF;
var_local = var;
var_local = 0;
var = var_local;
while ( 1 );
}
#include <mega8.h>
eeprom char var;
void main ( void )
{
char var_local;
var = 0xFF; // ESCRITA
var_local = var; // LEITURA
var_local = 0;
var = var_local; // ESCRITA
while ( 1 );
}
// EEPROM access example
// CodeVisionAVR C Compiler
// Chip: ATmega8515
flash char f[] = "This is a test";
#pragma warn-
eeprom char e[16]; // aqui define um vetor na eeprom
#pragma warn+
char r[16];
void main(void)
{
char flash *ptr_to_flash; // ponteiro para flash
char eeprom *ptr_to_eeprom; // ponteiro para eeprom
char *ptr_to_ram; // ponterio para ram
// copy the string f from FLASH to
// the string e in EEPROM
ptr_to_flash = f;
ptr_to_eeprom = e;
while (*ptr_to_flash) // lembre que no final da string fica falso (NULL).
*ptr_to_eeprom++ = *ptr_to_flash++;
// NULL terminate the string in EEPROM
*ptr_to_eeprom = 0;
// copy the string e from EEPROM to
// the string r in RAM
ptr_to_eeprom = e;
ptr_to_ram = r;
while (*ptr_to_eeprom)
*ptr_to_ram++ = *ptr_to_eeprom++;
// NULL terminate the string in RAM
*ptr_to_ram = 0;
// stop here
while (1);
}
#include <mega16.h>
eeprom unsigned char x @0x03;
eeprom unsigned char y @0x09;
void main ( void )
{
unsigned char var = 0;
// pra ler:
var = y;
// pra escrever na EEPROM:
x = 0xBC;
while ( 1 );
}
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante