View previous topic :: View next topic |
Author |
Message |
Chibouraska
Joined: 11 May 2007 Posts: 57 Location: Montreal,Canada
|
Bad array values |
Posted: Wed Oct 31, 2012 6:40 am |
|
|
Hi,
I am making a hydronic controller that controls fifteen temperature zones. Usually I don't need the forum but every time I used it I was very happy.
My problem is that my float array containing temperature values got corrupted. The array has 20 values in it but I only use 15, I keep the rest for expansion. So as I said it got corrupted, the first 8 values were ok and the last 7 were stuck at 16.0, where it was suppose to be 22.0 about.
So what I did instinctively is move the function to another place in the IDE and the problem was solved, but it left me with a void in my mind. I have built a prototype PCB around this controller the PIC24FJ128GA010. I programmed a LOT of times the MCU, so maybe the controller is getting tired.
Could this be that my array corruption was because of this. By chance my proto PCB is made the same way as the explorer16 board with a socket mount for the microcontroller. Any feedback is well appreciated. thx
AC
--------------------- _________________ think a bit at the time |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Oct 31, 2012 7:13 am |
|
|
I have had array corruption values in my past.
Every time this happened - it was because my code had a failure to control the array INDEX value or a pointer.
I have never had a PIC with bad user RAM ( EEPROM YES - user RAM - never been bad). |
|
|
Chibouraska
Joined: 11 May 2007 Posts: 57 Location: Montreal,Canada
|
|
Posted: Wed Oct 31, 2012 7:30 am |
|
|
Yes i know about the array index but in my case its not this. I am sure because i took the block of code and moved it and it solved the problem. I think its ROM corruption not RAM even if it looks like RAM because the values are bad.
It happened to me with RAM. I had these bugs that got fixed just by re- locating the global variable declaration from one place to another, why is this not sure??
I am always careful to declare enough cells in an array to contain all datum including zero terminator in strings. Thanks for your input.
AC
----------------- _________________ think a bit at the time |
|
|
|