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

melabs meprog and 18f252 EEPROM errors

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



Joined: 06 Nov 2005
Posts: 29

View user's profile Send private message

melabs meprog and 18f252 EEPROM errors
PostPosted: Mon Oct 09, 2006 11:11 pm     Reply with quote

HI all
Recently purchased a PIC programmer from melabs. http://www.melabs.com.
all seems fine except that it is having trouble with the #ROM statement.

On loading the hex into the windows software I get
"duplicate address at 00F000001" and other similar address errors.
after some debug work I recognised the area as the EEPROM memory and that the Programmer was expecting each #ROM to be 16 bit.
Where as I have "packed" two 8 bit into one location using direct addressing.
My old programmer had no trouble with this and so Im about to email melabs stating they may have an error. But I thought Id ask here first in case I was setting things up incorrectly.


common code
Code:

#define ee_mem_adr   0xF00000      //internal eeprom adress
#define ee_ioen   0x02   //previous io enable status
#define ee_flag   0x03   //various flags
#define ee_hibtl  0x22         //adr of hi battery lsb
#define ee_hibtm  0x23         //msb
#define ee_scnivll   0x24      //batt check timer ms lsb
#define ee_scnivlm   0x25      //msb


Doesnt like following:
Code:

#ROM ee_mem_adr+ee_ioen={0xF8}      //io enable
#ROM ee_mem_adr+ee_flag={0x02}   //ee_flags. human usr,log off off



where as this is ok
Code:

#ROM ee_mem_adr+ee_hibtl={614}      //hi battery threshold   (3000mv)
#ROM ee_mem_adr+ee_scnivll={2000}   //check battery interval(ms)


so the #ROM ee_mem_adr+ee_ioen={0xF8} //io enable
statement is interpreted by the melabs as adr:0xF00002 F8 00
ie two bytes not my expected one. the next statement should force 0xF00003 to 02 but melabs says that adr 03 has already been used and I cant have it.

melabs bug or my fault?[/code]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 09, 2006 11:29 pm     Reply with quote

See these threads for explanation and examples:
http://www.ccsinfo.com/forum/viewtopic.php?t=28175
http://www.ccsinfo.com/forum/viewtopic.php?t=23914
mds



Joined: 06 Nov 2005
Posts: 29

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 1:01 am     Reply with quote

Many thanks, but not the full quid.

Id put int8 everywhere but there Smile

However while it compiled and looked more like the goods in the proggers eeprom data window I still get the errors.

Ill email the company and see what they have to say.

what i found by looking at the hex file
Code:

#ROM int8 ee_mem_adr+ee_myadr0={"a"}   //sub address 1st letter
#ROM int8 ee_mem_adr+ee_myadr1={"b"}   //sub address 2nd letter
#ROM int8 ee_mem_adr+ee_ioen={0xF8}      //io enable
#ROM int8 ee_mem_adr+ee_flag={0x02}   //ee_flags. human usr,log
#ROM  ee_mem_adr+ee_amb={22}      //ambient

where adr were sequential. 00,01,02,03,04

:with int8
:without int8

:0200000400F00A
:0200000400F00A

:0200000061009D
:0200000061009D

:0200010062009B
:0200010062009B

:03000200F80216EB ***
:02000200F80004

:
:020003000200F9

:
:020004001600E4

:020000040030CA
:020000040030CA

:0E0000000022060F000181000FC00FE00F402C
:0E0000000022060F000181000FC00FE00F402C

:00000001FF
:00000001FF
;PIC18F252

*** as we can see the int8 concatenates three lines.
As indicated by the initial "03" Im assuming being the number of the bytes all this checks out as expected.

I therfore conclude melabs are doing something incorrect.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 1:25 am     Reply with quote

Quote:
#ROM int8 ee_mem_adr+ee_myadr0={"a"} //sub address 1st letter
#ROM int8 ee_mem_adr+ee_myadr1={"b"} //sub address 2nd letter
#ROM int8 ee_mem_adr+ee_ioen={0xF8} //io enable
#ROM int8 ee_mem_adr+ee_flag={0x02} //ee_flags. human usr,log
#ROM ee_mem_adr+ee_amb={22} //ambient

You put in several new constants in your code, such as ee_myaddr0,
ee_myadr1, and ee_amb, but you didn't show the #define statements
for them in your post, so I can't really test the code.

But I do see one problem. You've put in the lower case letters
in double quotes. This makes them into a string, instead of a byte.
In other words, "a" means 0x61 and 0x00. "b" means 0x62 and 0x00.
You should use 'a' and 'b' with single quotes. Do it that way and
see what happens.
mds



Joined: 06 Nov 2005
Posts: 29

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 5:02 pm     Reply with quote

aghh yes I was chasing two different problems and not seeing the trees.
that did it
Many thanks.
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