setting avr after shutdown

Go To Last Post
111 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how to set the avr chip (atmega8) after shutdown or power turn off? how to make it keep the parameter settings that i entered ( for example reference temperature ) if the power turned off?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Non-volatile memory perhaps...

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Once the power has gone, you really can’t do too much. The general trick is to sense when power has failed but have enough energy stored in a capacitor to allow the AVR to keep on running for a few tens of milliseconds so it can write the data to eeprom.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:

how to make it keep the parameter settings that i entered ( for example reference temperature ) if the power turned off?

 

Russell,

 

I took those words to mean that he will store data before his power goes... eg calibration data, to be retrieved and applied when power returns. But I may be wrong... again. cheeky

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That mean i can write the configured parameters to eeprom a minute before power failure and restore it again from eeprom  after power on, right?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

Non-volatile memory perhaps...

@OP, by which he means... Start by looking at the EEPROM memory your AVR already contains.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
I took those words to mean that he will store data before his power goes... eg calibration data, to be retrieved and applied when power returns. But I may be wrong... again. cheeky

 

in which case the solution is easy

write the data to eeprom when it is set/changed & read it back on reset

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok, Could i access the eeprom while the main program is running or should it be done after power reset?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you can access the eeprom at anytime.

Last Edited: Sun. Feb 18, 2018 - 10:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:

ok, Could i access the eeprom while the main program is running or should it be done after power reset?

 

The atmega8 has its own EEPROM as per its data sheet entry...

 

 

I only replied generally by saying "non-volatile memory"' because you did not say how much data you needed to save or how often. If you expect to exceed either of the above specifications you would need to use an external EEPROM device. There are many examples of using the I2C interface (which is called TWI by Atmel) to external EEPROM devices such as in the 24Cxxx family.

 

As for when you should write your data and retrieve it.... well that depends upon your own design requirements. As others have said you could do it as soon as your hardware detects a power failure but you would need to hold sufficient energy to complete the writing activity and that can also be dependent upon how much you need to save.... none of which we know!

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Several times you've said something about doing thing AFTER power down. I fear you are misunderstanding something. Whether by "power down" you really mean removal of Vcc or just SLEEP. The fact is that in either case the CPU has stopped executing oppose fetch cycles do it cannot actually do ANYTHING. If either Vcc is going away (monitor power line with ADC and watch for it dropping away) or you are about to SLEEP you have to get all your "preparation" finished before the CPU enters stasis.

Last Edited: Sun. Feb 18, 2018 - 01:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The fact is that in either case the CPU has stopped executing oppose fetch cycles do it cannot actually do ANYTHING.

Care to read that aloud... crying

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh this bloody tablet. "Opcodes" becomes "Oppose".

 

The irony is that I switched from using my usual "Swiftkey" predictive keyboard to the standard Samsung/Android one as it seems to play better with the code editor here but its memory of recent words and prediction are worse.

 

Given recent discussion I won't edit above so subsequent comments make sense.

Last Edited: Sun. Feb 18, 2018 - 01:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Several times you've said something about doing thing AFTER power down.

As it doesn't make much sense to talk about what is happening inside the unpowered micro, I read that as running->power loss->resume/power-on reset.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I write eeprom code inside main program(atmega8), what should i burn, just the hex file or eeprom file? I use top win universal programmer

Last Edited: Wed. Feb 21, 2018 - 10:01 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Your choice. Usually when i use the eeprom, i put a ‘magic’ value in a given location. When my code begins, it checks that location for the ‘magic’ value. If it is there, i can assume i have already initialised the eeprom storage. If not, i have code to write default values and then write the ‘magic’ value.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it display ( -INF ) on lcd, however it is working on proteus

Last Edited: Wed. Feb 21, 2018 - 10:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what is "it" ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When erased, the eeprom assumes a value of all ‘1’s or 0xff. A floating point number of 0xff’s probably is NotANumber (Nan). Proteus may initialise the virtual eeprom to 0’s. Refer to my technique above to initialise the eeprom.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the lcd

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

could you give me example code for your method?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No. I don’t have code on my tablet and it is a pain to write.
What part of my explanation did you not grasp?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what do you mean "i put a ‘magic’ value in a given location." location is address but what is the magic number?

 

I tried this code but for integer , is that what you mean

 

/*****************************************************

Chip type               : ATmega8
Program type            : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model            : Small
External RAM size       : 0
Data Stack size         : 256
*****************************************************/
#include <mega8.h>
 #include <delay.h>
 #include <stdlib.h>
  #include <stdio.h>
 #include <delay.h>
// Alphanumeric LCD functions
#include <alcd.h>

#pragma warn-
eeprom unsigned int a=3;
unsigned int eeprom *float_ptr_to_eeprom;
#pragma warn+
unsigned int Tref=10;
unsigned int  *float_ptr_to_ram;

unsigned char str[16]; //allocate on lcd  

void main(void)
{

// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0x00;
DDRB=0xFF;
// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTD=0x00;
DDRD=0xFF;

  lcd_init(16);
      lcd_clear(); 

float_ptr_to_eeprom=&a;
float_ptr_to_ram=&Tref;
;

*float_ptr_to_ram=*float_ptr_to_eeprom;
delay_ms(100);

while (1)
{

     if(PIND.3 == 1)
        {
               Tref=Tref+1;
                *float_ptr_to_eeprom=*float_ptr_to_ram;
        }
        if(PIND.0 == 1)
        {
                Tref=Tref-1;
                *float_ptr_to_eeprom=*float_ptr_to_ram;
        }

        delay_ms(100);
         lcd_gotoxy(0,1);
       lcd_putsf("Tref=");

        sprintf(str,"%u",Tref);

         lcd_puts(str);
  }

    }

 

Last Edited: Wed. Feb 21, 2018 - 05:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:
what is the magic number?

Any value you want that is not 0xFF or 0xFFFF

 

Jim

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:
what is the magic number?

https://en.wikipedia.org/wiki/Magic_number_(programming)

Distinctive unique values that are unlikely to be mistaken for other meanings

 

 

EDIT

 

Sometimes called a "sentinel"

 

https://en.wikipedia.org/wiki/Sentinel_value

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Feb 21, 2018 - 03:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not directly relevant, but:

 

In general, main() returns int in C. If you have a book that suggests it should return void, the book is probably bad. (Like, the books I've seen do that have been full of other errors.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the_real_seebs wrote:
In general, main() returns int in C. If you have a book that suggests it should return void, the book is probably bad.

No.  Not true.  See the standard.  Do you have a "hosted", or "free-standing" installation?  Whatever GCC does must be correct, right?  And any printed commentary with conflicts must be heretical, and should be burnt and banned from any further publication.  Regardless of how ridiculous it is to return from main() in an AVR8 application --  where are you going to return to?!?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Wed. Feb 21, 2018 - 03:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the_real_seebs wrote:
In general, main() returns int in C.

True. 

But, in general, main() does not return at all in embedded microcontroller projects.

 

Therefore, some specifically-embedded compilers do have void main().

 

If you have a book that suggests it should return void, the book is probably bad

maybe; maybe not ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
See the standard.

Indeed:

ISO/IEC 9899:1990, "Programming languages - C wrote:

5.1.2.1 Freestanding environment

 

In a freestanding environment ... the name and type of the function called at program startup are implementation-defined.

So it need not be called main, and it need not return int.

 

 

EDIT

 

So he beat me to it. Twice.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Feb 21, 2018 - 03:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Therefore, some specifically-embedded compilers do have void main().

While I was ranting, I wondered about that "book" reference.  Then I realized that (I think) it was the CodeVision Wizard-produced skeleton that OP posted.  And indeed CV does void main(void);

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

do you mean something like this

#pragma warn-
eeprom float a=37.5;
eeprom float a @0x80;
float eeprom *float_ptr_to_eeprom;
#pragma warn+
 float Tref=123;
 float Tref @0x182;

float  *float_ptr_to_ram;

what to do after that?

Last Edited: Wed. Feb 21, 2018 - 05:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Point of order: I was on the standards committee for ten years, I am aware that freestanding implementations can be different, etcetera. But I also note that the embedded environments I've been in that had a main() at all usually accepted an int main(), even if there was nothing for it to return to.

 

 

But I've yet to see a book on C that advocated "void main" and wasn't awful. It might not be wrong in embedded enviroments, depending on the environment, but it's never been a sign of a book that's going to be right on everything else. The point here isn't "you should definitely change the code"; it's "if you happen to have gotten this from a C book, you might want to double-check the book's quality, since this is usually a red flag".

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the_real_seebs wrote:
"if you happen to have gotten this from a C book,

But it was only you that mentioned "book", wasn't it?  Indeed, in checking that I see your relevancy disclaimer.

 

Lessee--not really relevant, but fall plowing tends to lead to more erosion.

 

In digging back through the prior "int main()" discussions, Joerg brought up some interesting reasons on why GCC for the AVR target doesn't have freestanding as the default, even though it is available.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the_real_seebs I think you need to get some real world experience. Codevision (AFAIK) has always used "void main(... ". It also does PORTB.5. These are actually clever/practical ideas for the kind of environment AVRs present.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm pretty sure I have some real-world experience, though? And if the compiler prefers that, hey, that's fine. I wasn't aware of that, I've always just used the standard main() for AVR stuff (or Arduino's godawful mess, which I am less fond of), and I think that also works? So not being aware that a particular IDE did that by default, and having seen people around here get tripped up by Schildt's books in the past, I figured I'd offer a possibly-relevant tip to a newbie who might be getting C language tips from a questionable source. If they're not, great! No problem. But if I'm not sure, and I see something that's sometimes an indicator that someone might be in for an easily-avoidable bit of hassle later, I tend to warn them. The cost of mentioning a possible concern is usually low.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, we went off on this tangent...

 

Anyway, OP did post a complete (as far as I can see) test program.  But it appears to me that there still isn't a grasp of what EEPROM on an AVR8 microcontroller will and won't do.  Every pass through the main loop, there will be an assignment to EEPROM.  I guess that is OK for a test program if e.g. the port D inputs are connected to buttons for testing, with the 100ms delay giving some debounce protection?  (but won't presses less than 100ms likely be lost?)

 

[Why are we doing float? ]

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code is confusing - why ‘float pointer’ when it is referring to ints? Why pointers at all?

First rule of eeprom- only write when necessary.

I’ve not used codvision, but i gather it handles the eeprom read/write as if it were a normal variable.

So the code would go a little like this:

eeprom uint8_t token;
eeprom int value;
#define MAGIC 123

If token != MAGIC then
Begin
value = 0. ; init the stored values
token = MAGIC ; set token to say we’ve been initialised
End

Last Edited: Wed. Feb 21, 2018 - 09:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this working with float numbers? , i want to store float value.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Declare a float value in eeprom then!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Like any other memory, the EEPROM just stores bytes - it neither knows nor cares what those bytes mean to you or your program.

 

A float value - like any other data - is just a sequence of bytes.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

as i said in # 17 the display shows (-inf) or (nan) with float declare

/*****************************************************

Chip type               : ATmega8
Program type            : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model            : Small
External RAM size       : 0
Data Stack size         : 256
*****************************************************/
#include <mega8.h>
 #include <delay.h>
 #include <stdlib.h>
  #include <stdio.h>
 #include <delay.h>
// Alphanumeric LCD functions
#include <alcd.h>

#pragma warn-
eeprom float a=37.5;
float eeprom *float_ptr_to_eeprom;
#pragma warn+
float Tref=23;
float  *float_ptr_to_ram;
#define ADC_VREF_TYPE 0x00

// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}

float delta,adc;
char str[16]; //allocate on lcd
int currentValue ; 

void main(void)
{

// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0x00;
DDRB=0xFF;
// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTD=0x00;
DDRD=0xFF;

// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: AREF pin
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x83;
// Alphanumeric LCD initialization// Connections are specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu:// RS - PORTD Bit 0// RD - PORTD Bit 1// EN - PORTD Bit 2
// D4 - PORTD Bit 4// D5 - PORTD Bit 5// D6 - PORTD Bit 6// D7 - PORTD Bit 7// Characters/line: 16
  lcd_init(16);
      lcd_clear(); 

float_ptr_to_eeprom=&a;
float_ptr_to_ram=&Tref;
;

*float_ptr_to_ram=*float_ptr_to_eeprom;
delay_ms(100);

while (1)
{

         

     if(PIND.3 == 1)
        {
               Tref=Tref+0.1;
                *float_ptr_to_eeprom=*float_ptr_to_ram;
        }
        if(PIND.2 == 1)
        {
                Tref=Tref-0.1;
                *float_ptr_to_eeprom=*float_ptr_to_ram;
        }

        delay_ms(100);
         lcd_gotoxy(0,1);
       lcd_putsf("Tref=");
       ftoa(Tref, 0x01, str);
         lcd_puts(str);
  }

    }  

 

Last Edited: Thu. Feb 22, 2018 - 09:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you do something like this:

eeprom float a=37.5;

then when you build Codevision will create TWO intel hex files. The usual one that you always program into the flash (project.hex or something) but it will also create a file called something like project.eep which is also intel hex but it contains the initial value for EEPROM (in this case 37.5 to go into the location labelled "a" - BTW that is a terrible name for a variable - says nothing about what it is used for). When you program the AVR either in real silicon or in simulator you have to arrange for project.hex to go into the flash and project.eep to go into the EEPROM

 

(ottherwise EEPROM will still contain all 0xFF bytes an in float four 0xFF is read as "NAN")

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some EEPROM writing routine do not write if the value is equal to the stored value. (it is called updating, IIRC); that is very simple to write... and avoids eating cycles (EEPROM writes are slow, slower than reading) and wearing. Then, with unfrequent writes , the issue of writing when power is shut down is not essential (I bet TV, a century ago : already saved settings in a EEPROM did not care with power down: they stored settings **only** when they were modified)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

that was my question , how to burn the project.eeprom to the chip. i choosed atmega 8 and upload the main.hex how to upload the eeprom file?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your ISP programming software should have options for programming both flash and EEPROM. Send hex to one, eep to the other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it has eeprom chip and avr chip but eeprom inside avr chip is not available

this is my programmerhttp://aidetek.com/mm5/merchant.mvc?Screen=PROD&Store_Code=A&Product_Code=TOP2049&Category_Code=Programmer

Last Edited: Thu. Feb 22, 2018 - 11:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:
eeprom inside avr chip is not available

Then it's a pretty rubbish programmer!

 

Especially for nearly $140 !!

 

surprise

 

With the current offer, you could get two Atmel-ICEs for that!!

 

https://www.avrfreaks.net/forum/atmel-ice-50

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Or write a few lines of code to do the initialisation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

engmado wrote:

it has eeprom chip and avr chip but eeprom inside avr chip is not available

this is my programmerhttp://aidetek.com/mm5/merchant.mvc?Screen=PROD&Store_Code=A&Product_Code=TOP2049&Category_Code=Programmer

I'd toss that in the bin (very suspicious that if I want to see the manual it delivers an EXE file to me!). Get yourself onto ebay and spend just two bucks on a USBAsp. It's going to be a far more proficient AVR programming solution than that thing looks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how to initialze, Isn't my code enough?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your programmer cannot write into the EEPROM,

a dedicated program can do it.

you have to write : a program which sets the EEPROM data (it gets loaded into the AVR, sets EEPROM data** if needed**, and then is no use)

another which reads them (for current use).

 

Or you can merge these two pieces of software into one (witing into/updating EEPROM at the beginning).

 

A disadvantage is that flash wears 10 times faster than EEPROM, IIRC.

Pages