Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] Am getting aerror as follows when i compile the program in avr

Status
Not open for further replies.

thannara123

Advanced Member level 4
Joined
Jan 7, 2010
Messages
1,455
Helped
120
Reputation
240
Reaction score
110
Trophy points
1,353
Location
God's Own country India, India
Activity points
9,426
Code:
#include <avr/io.h>
#include <inttypes.h>


#include "eeprom.h"


uint8_t EEPROMRead(uint16_t uiAddress)
{
    /* Wait for completion of previous write */
    while(EECR & (1<<EEWE));
    /* Set up address register */
    EEAR = uiAddress;
    /* Start eeprom read by writing EERE */
    EECR |= (1<<EERE);
    /* Return data from data register */
    return EEDR;
}


void EEPROMWrite(uint16_t uiAddress, uint8_t ucData)
{
    /* Wait for completion of previous write */
    while(EECR & (1<<EEWE));
    /* Set up address and data registers */
    EEAR = uiAddress;
    EEDR = ucData;
    /* Write logical one to EEMWE */
    EECR |= (1<<EEMWE);
    /* Start eeprom write by setting EEWE */
    EECR |= (1<<EEWE);
}
Build started 19.12.2012 at 09:25:40
avr-gcc.exe -mmcu=attiny2313 -Wall -gdwarf-2 -DF_CPU=1000000UL -O2 -fsigned-char -MD -MP -MT eeprom.o -MF dep/eeprom.o.d -c ../eeprom.c
../eeprom.c: In function 'EEPROMRead':
../eeprom.c:9: error: 'EEWE' undeclared (first use in this function)
../eeprom.c:9: error: (Each undeclared identifier is reported only once
../eeprom.c:9: error: for each function it appears in.)
../eeprom.c: In function 'EEPROMWrite':
../eeprom.c:21: error: 'EEWE' undeclared (first use in this function)
../eeprom.c:26: error: 'EEMWE' undeclared (first use in this function)
make: *** [eeprom.o] Error 1
Build failed with 5 errors and 0 warnings...



â​How can i rectify ?.

- - - Updated - - -

yes I got and changed as follows
Code:
#include <avr/io.h>
#include <inttypes.h>

#include "eeprom.h"

uint8_t EEPROMRead(uint16_t uiAddress)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEPE));
	/* Set up address register */
	EEAR = uiAddress;
	/* Start eeprom read by writing EERE */
	EECR |= (1<<EERE);
	/* Return data from data register */
	return EEDR;
}

void EEPROMWrite(uint16_t uiAddress, uint8_t ucData)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEPE));
	/* Set up address and data registers */
	EEAR = uiAddress;
	EEDR = ucData;
	/* Write logical one to EEMWE */
	EECR |= (1<<EEMPE);
	/* Start eeprom write by setting EEWE */
	EECR |= (1<<EEPE);
}
 

thannara123

Advanced Member level 4
Joined
Jan 7, 2010
Messages
1,455
Helped
120
Reputation
240
Reaction score
110
Trophy points
1,353
Location
God's Own country India, India
Activity points
9,426
Yes sir ,


Code:
#include <avr/io.h>
#include <inttypes.h>

#include "eeprom.h"

uint8_t EEPROMRead(uint16_t uiAddress)
{
	/* Wait for completion of previous write */
	[COLOR="#FF0000"]while(EECR & (1<<EEPE));[/COLOR]      // changed 
	/* Set up address register */
	EEAR = uiAddress;
	/* Start eeprom read by writing EERE */
	EECR |= (1<<EERE);
	/* Return data from data register */
	return EEDR;
}

void EEPROMWrite(uint16_t uiAddress, uint8_t ucData)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEPE));
	/* Set up address and data registers */
	EEAR = uiAddress;
	EEDR = ucData;
	/* Write logical one to EEMWE */
	EECR |= (1<<EEMPE);
	/* Start eeprom write by setting EEWE */
	[COLOR="#FF0000"][COLOR="#FF0000"]EECR |= (1<<EEPE);[/COLOR][/COLOR]
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top