??? 07/07/08 02:19 Read: times |
#156445 - Data Array getting corrupted after init |
Now that I've got the bubble sort going with some help (thanks guys) and I went to evaluate the functionality and I'm finding out that the arrays are being overwritten after they are initialized. It seems they are writing to arrays that they are not being address. I've sent an email off to Juergen who was good enough to drop me a line for some clarification.
Here is a copy of the email I sent him. Any idea what is going on? Why would an array that is not being address be modified? Two of the arrays are in my io.c file and the other is in the main.c. The arrays do initialize properly, so here is the email. I have 3 functional arrays for data processing and program flow direction. char zoom_array[7] = {9,4,2,8,3,6,5}; D:0x0Eh location unsigned char FOCUS_STATUS[] = {1}; D:0x17h location extern char operational_array[] = {1,0,0,0,0}; D:0x09h location Clearly there is no overlap but during initialization I'm recalling a value to repopulate the array and it is corrupting the zoom_array at the element it is defining. eeprom_init(); eeprom_read(0x000); //Restore last contrast flag from memory operational_array[4] = DEEDAT; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< the corruptor of zoom_array at elements 3 and 4 eeprom_read(0x001); //Restore last contrast mode of operation operational_array[0] = DEEDAT; Listed at the corrupter above, it corrupts my zoom array at that element with whatever data is at 0x000 in the EEPROM. If I comment out the line the initialization values remain until the function is called and properly populated by the input data stream that is supposed to file it. I chose those values, 9,4,2 etc just to verify operation and easy to remember for me. Any ideas why this could be happening? Elements 3 and 4 of the array are the only ones affected, all the other remain at init values. |
Topic | Author | Date |
Data Array getting corrupted after init | 01/01/70 00:00 | |
OnePossibleIdea.... | 01/01/70 00:00 | |
I did not do anything with the stack | 01/01/70 00:00 | |
As Michael said.... | 01/01/70 00:00 | |
How do you test and debug code? | 01/01/70 00:00 | |
Keil is the only thing in place | 01/01/70 00:00 | |
'crap'?? | 01/01/70 00:00 | |
Is this the book you refer? | 01/01/70 00:00 | |
nope | 01/01/70 00:00 | |
Erik | 01/01/70 00:00 | |
So where is the code | 01/01/70 00:00 | |
do NOT "put them" | 01/01/70 00:00 | |
Focus | 01/01/70 00:00 | |
Simulator | 01/01/70 00:00 | |
So this is on a simulator? | 01/01/70 00:00 | |
Post your duff code | 01/01/70 00:00 | |
Finding Cause of Corruption | 01/01/70 00:00 | |
Get the C right, then look at the target CPU | 01/01/70 00:00 | |
Optimizing Compilers | 01/01/70 00:00 | |
In my experience..... | 01/01/70 00:00 | |
Keil C 51 Optimizations | 01/01/70 00:00 | |
Use IAR then | 01/01/70 00:00 | |
different approaches | 01/01/70 00:00 | |
sometimes, depends | 01/01/70 00:00 | |
Thanks![]() | 01/01/70 00:00 |