Writing variables to nonvolitile memory using xdata
My MCU is ADuC841 it had (working with SDK)
62 kBytes on-chip Flash/EE program memory 4 kBytes on-chip Flash/EE data memory
I want to store variable that i get from the serial port and write them to the EEPROM then turn off, turn on the MCU and read them some how (print the stored variable to screen = Hyperterminal) or using interrupt that prints it to screen.
my code is working on the the simulator of keil i see the memory window but on then target MCU it doesn't work
My code:
unsigned char xdata large_array[20] _at_ 1500; unsigned int xdata timer_tick; void INT_EX0() interrupt 0 { puts(large_array); } void main (void) { while(1) { T3CON = 0x87; // 4800 T3FD = 0x08; SCON = 0x52; IT0 = 1; // Configure interrupt 0 for falling edge on /INT0 (P3.2) EX0 = 1; // Enable EX0 Interrupt EA = 1; puts("\nEnter string :"); getline(large_array); // get string from serial port puts(large_array); // read from memory and output to serial port } }
the output of the MCU on Hyperterminal is something like all the char in ascii - "abcdefg...!@#$%^&*()..."
WHAT IS THE PROBLEM ??
Thanks in advance !!!
Mayer
How many other ways are listed in the Datasheet...?
Andy, Hans
I read the datasheet as you said (i did it before i started the thread)
In the datasheet i saw that there is only one way to program the EE/FLASH data memory.
But this method of programing is very (relatively) complex. Using 6 sfr to program one char (i.e 'A') is too much in my opinion ?!?!?
My question is that :
All MCU that i want to program there EE/FLASH data memory is in that "fashion" ?? (using few sfr do to a little change in the EE/FLASH data memory)
Using an array of varibles in C (int for example) is very easy (opposed to ammebler to an array relatively is harder)
What is the advantges of "C" on assembler in this issue ?? (writing to the EE/FLASH data memory)
The solution for my first question (writing to the EE/FLASH data memory - with few changes)
http://www.keil.com/download/docs/184.asp
Using 6 sfr to program one char (i.e 'A') is too much in my opinion ?!?!?
Sorry to burst your bubble, but your opinion is entirely irrelevant in this regard. As is anybody else's, lest they happen to be MCU designers.
And BTW, writing a single char doesn't take 6 SFRs --- 4 are quite sufficient.
All MCU that i want to program there EE/FLASH data memory is in that "fashion" ??
How could anyone possibly answer that? Nobody but you knows what "All MCU that i want to program" means.
What is the advantges of "C" on assembler in this issue ??
None. So what?