CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

read_eeprom() function problem with V4.030 ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jim Hearne



Joined: 22 Dec 2003
Posts: 109
Location: West Sussex, UK

View user's profile Send private message Send e-mail Visit poster's website

read_eeprom() function problem with V4.030 ?
PostPosted: Wed Mar 21, 2007 12:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 21, 2007 12:43 pm     Reply with quote

Make sure you're not being hit by the change to the "address of"
operator, which was done in vs. 4.021. See this post for details:
http://www.ccsinfo.com/forum/viewtopic.php?t=30093&start=9
Jim Hearne



Joined: 22 Dec 2003
Posts: 109
Location: West Sussex, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Mar 21, 2007 2:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 22, 2007 4:02 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Mar 22, 2007 4:25 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 22, 2007 4:27 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Mar 22, 2007 4:42 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group