View previous topic :: View next topic |
Author |
Message |
Jim Hearne
Joined: 22 Dec 2003 Posts: 109 Location: West Sussex, UK
|
read_eeprom() function problem with V4.030 ? |
Posted: Wed Mar 21, 2007 12:09 pm |
|
|
Hi All, i've just renewed our subscription and downloaded version 4.030 after i found there seemed to be a bug in 3.249 that was fixed in 4.020 (the last version i had).
Now the same code that works fine with 4.020 has a problem compiled with 4.030 in that the read_eeprom() function always returns 0
I can see from the debugger i'm writing to it correctly and what address i'm reading but it's always 0.
recompile with 4.020 and it's fine.
This is on a pic 18LF6722
Thanks,
Jim |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Jim Hearne
Joined: 22 Dec 2003 Posts: 109 Location: West Sussex, UK
|
|
Posted: Wed Mar 21, 2007 2:46 pm |
|
|
Thanks, i don't think it's that, that was the first problem i had with v4.030 but it causes compile errors and i remembered seeing that mentioned on here before.
Running with the debugger on and single stepping i can look at the variable returned from the the read_eeprom command and it's always zero if compiled with 4.030
Thanks,
Jim |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 22, 2007 4:02 pm |
|
|
I compiled the following test program for PCH vs. 4.020 and 4.030.
It gives the same code in the .LST file for each version. I compared
the two .LST files by opening a DOS window and using the fc command.
The only line that's different between the two files is the compiler
version line.
Code: |
#include <18F6722.h>
#fuses XT, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=4000000)
//========================
void main()
{
int8 c;
c = read_eeprom(0x10);
while(1);
} |
Compiled with vs. 4.030:
Code: |
.................... c = read_eeprom(0x10);
00018: MOVFF FF2,07
0001C: BCF FF2.7
0001E: CLRF FAA
00020: MOVLW 10
00022: MOVWF FA9
00024: BCF FA6.6
00026: BCF FA6.7
00028: BSF FA6.0
0002A: MOVF FA8,W
0002C: BTFSC 07.7
0002E: BSF FF2.7
00030: MOVWF 06
|
Compiled with vs. 4.020:
Code: |
.................... c = read_eeprom(0x10);
00018: MOVFF FF2,07
0001C: BCF FF2.7
0001E: CLRF FAA
00020: MOVLW 10
00022: MOVWF FA9
00024: BCF FA6.6
00026: BCF FA6.7
00028: BSF FA6.0
0002A: MOVF FA8,W
0002C: BTFSC 07.7
0002E: BSF FF2.7
00030: MOVWF 06 |
|
|
|
Jim Hearne
Joined: 22 Dec 2003 Posts: 109 Location: West Sussex, UK
|
|
Posted: Thu Mar 22, 2007 4:25 pm |
|
|
Thanks PCM,
I've not had a chance to do any basic tests like that yet.
How about if the address is passed as a variable (or rather 2 added together in my case) ? E.g c=read_eeprom(base+offset)
I did some more work on the code in 4.020 today with no problems and quickly recompiled it with 4.030 before i went home, it still has the same problem with 4.030 in that variables stored into the eeprom read back as zero.
Complied 4.020 and 3.249 work fine. Except 3.249 will lockup the pic at random intervals which 4.020 doesn't.
CCS have the full list files for both compiled versions so we will see if they find anything.
Jim |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 22, 2007 4:27 pm |
|
|
If you can post a small test program (very small) that shows the problem
then I can work on it. |
|
|
Jim Hearne
Joined: 22 Dec 2003 Posts: 109 Location: West Sussex, UK
|
|
Posted: Thu Mar 22, 2007 4:42 pm |
|
|
I will as soon as i get a chance.
The boss is more interested in me getting the code finished (with 4.020) than why the other compiler versions don't work.
But i do like to know the cause of these problems.
Thanks,
Jim |
|
|
|