PIC18F47K42 EEPROM

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
pumper
Posts: 285
Joined: 10 Jan 2011 17:37

PIC18F47K42 EEPROM

#1 Post by pumper » 27 Apr 2024 21:39

I have converted an old program for pic18f46k22 for the pic18f47k42.

When I try to load the new program on to the pic18f47k42 it says trying to load file bigger than the device can hold. Hard to believe because the pic18f47k22 has a lot more memory.
The program memory summary shows more than 57% available on both data and rom storage.
It loads the program file or part of it I can't tell but not the EEPROM.
Loading with PICKITminus.

Any ideas on what is going on?

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: PIC18F47K42 EEPROM

#2 Post by pumper » 28 Apr 2024 23:18

This only happens if I have an EEPROM file to load. Is this a problem with PICKITminus programmer or is there a setup I have to do with the program itself to allow the program to be loaded onto my hardware?

paulfjujo
Posts: 1552
Joined: 24 Jun 2007 19:27
Location: 01800 St Maurice de Gourdans France
Contact:

Re: PIC18F47K42 EEPROM

#3 Post by paulfjujo » 29 Apr 2024 10:28

Hello,


:o There is a bug in MikroC compiler !!!!
it is a old problem, not solved by MikroE ..

usage de l'eeprom PIC
Rappel bug MikroC sur adresse départ Eeeprom => à modifier!
dans Eeeprom file *.ihex

Code: Select all

OLD adresse  :02000004[b]0121[/b]D8                          2101H   because reverse order : LSB then MSB
[b]NEW adresse[/b]  :02000004[b]0031[/b]C9                   3100 H
=> modifier l'adresse de base dans le fichier *.ihex

manualy modifiy the start adress into the file *.ihex
do not re compile !
just upload it with pickit3..



Code: Select all


avec MPLABX IPE  
adresse debut EEPROM =  310000  
adresse fin   EEPROM=   3103FF

C:\_MikroC\mikroC PRO for PIC\Defs\P18F27K42.mlk
EEPROM 18F27K42

<?xml version="1.0"?>
<MCU>
	<DEVICE_NAME>P18F27K42</DEVICE_NAME>
	<ROM>
		<MIN_ADDR>0x0</MIN_ADDR>
		<MAX_ADDR>0x1FFFF</MAX_ADDR>
	</ROM>
	<EXT_ROM>
		<MIN_ADDR>0x20000</MIN_ADDR>
		<MAX_ADDR>0x1FFFFF</MAX_ADDR>
	</EXT_ROM>
.ligne 940.....
    <EEPROM>
		<MIN_ADDR>0x310000</MIN_ADDR>  -- <MIN_ADDR>0x00310000</MIN_ADDR>
		<MAX_ADDR>0x3103FF</MAX_ADDR>  ---<MAX_ADDR>0x003103FF</MAX_ADDR> 
	</EEPROM>	

pumper
Posts: 285
Joined: 10 Jan 2011 17:37

Re: PIC18F47K42 EEPROM

#4 Post by pumper » 29 Apr 2024 21:42

I changed the first line in the.ihex file to :020000040031C9
I don't have PICKIT3 so I used PICKIT2 it did not like it when I tried to upload.

For the P18F47K42.mlk it is up to date with what you sent me.

I have the Microchip PDF file for the PIC18F47K42 and it is nothing like what you describe for the eeprom.
It describes procedures for the eeprom write and read like a Bank would make me go through to get my money.

If you have it look at section 13.3 DATA EEPROM MEMORY.

It's got me confused.
As you can tell I am not a real programmer just an old man trying to use MICROC for my projects.
I do appreciate your help.

paulfjujo
Posts: 1552
Joined: 24 Jun 2007 19:27
Location: 01800 St Maurice de Gourdans France
Contact:

Re: PIC18F47K42 EEPROM

#5 Post by paulfjujo » 30 Apr 2024 09:34

hello,


Since One year, i not use anymore MikroC ..because not updated for new MCU
Must use Necto Studio wich replace MikroC , but it is to much complicated and Heavy....
and need additional cost to pay !! even you allready have a MickroC Pro Licence.

i use MPLABX XC8 , mode difficult to learn, but at least can do the job... and free of charge!

look at this application
http://paulfjujo.free.fr/Projet_Clavier ... htm#Eeprom
use of EEPROM
Nota : Eeprom is loaded with MPLABX IPE !

i use Pickit4 !
because Pickit3 with Pickit3 Minus is not 100% OK .... maybe my Pickit3 is too old ..(me too!)

Code: Select all

EEprom test:
/*
// run une fois !
CPrint(" TEST Write To Eeeprom \r\n");
for (i=0;i<1023;i=i+16)
{
cx = (unsigned char) (i & 0x00FF);
EEPROM_Write(i,cx);
Delay_ms(5);
WordToStr(i,CRam1);
CPrint(" Write EEPROM @= ");
Print(CRam1);Espaces;
ByteToStr(cx,CRam1); Print(CRam1);
CRLF1();
}
*/

CPrint("\r\n ------------------\r\n TEST Read Eeeprom \r\n");
for (i=0;i<1023;i=i+16)
{
cx=EEPROM_Read(i);
Delay_ms(5) ;
WordToStr(i,CRam1);
CPrint(" read EEPROM @ ");
Print(CRam1);Espaces;
ByteToStr(cx,CRam1); Print(CRam1);
CRLF1();
}
CPrint("\r\n End\r\n");
while(1);
Test en rechargeant le *.HEX
et cochant protection EEPROM dans MPLAB IPE !!
Resultat on YAT terminal:
(0.000) ------------------
(0.003) TEST Read Eeeprom
(0.004) read EEPROM @ 0 0
(0.008) read EEPROM @ 16 16
(0.007) read EEPROM @ 32 32
(0.007) read EEPROM @ 48 48
(0.007) read EEPROM @ 64 64
(0.008) read EEPROM @ 80 80
(0.007) read EEPROM @ 96 96
(.... etc ....)
((0.008) read EEPROM @ 928 160
(0.006) read EEPROM @ 944 176
(0.008) read EEPROM @ 960 192
(0.007) read EEPROM @ 976 208
(0.007) read EEPROM @ 992 224
(0.007) read EEPROM @ 1008 240
(0.002)
(0.000) End

SINON, avec protection EEPROM NON cochée => RAZ EEPROM

(0.000)
(0.000) ------------------
(0.000) TEST Read Eeeprom
(0.000) read EEPROM @ 0 255
(0.032) read EEPROM @ 16 255
(0.000) read EEPROM @ 32 255
(0.000) read EEPROM @ 48 255
(0.000) read EEPROM @ 64 255
(0.000) read EEPROM @ 80 255
... etc ...
(0.000) read EEPROM @ 976 255
(0.036) read EEPROM @ 992 255
(0.000) read EEPROM @ 1008 255
(0.000)
(0.000) End
nota: maybe you can use Data in Flashcode Area instead of PIC Eeprom ?

Post Reply

Return to “mikroC PRO for PIC General”