View previous topic :: View next topic |
Author |
Message |
mds
Joined: 06 Nov 2005 Posts: 29
|
melabs meprog and 18f252 EEPROM errors |
Posted: Mon Oct 09, 2006 11:11 pm |
|
|
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
|
|
|
mds
Joined: 06 Nov 2005 Posts: 29
|
|
Posted: Tue Oct 10, 2006 1:01 am |
|
|
Many thanks, but not the full quid.
Id put int8 everywhere but there
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
|
|
Posted: Tue Oct 10, 2006 1:25 am |
|
|
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
|
|
Posted: Tue Oct 10, 2006 5:02 pm |
|
|
aghh yes I was chasing two different problems and not seeing the trees.
that did it
Many thanks. |
|
|
|