View previous topic :: View next topic |
Author |
Message |
mfer
Joined: 11 Jan 2007 Posts: 8
|
18F45J10 write_program_memory() compiles to nothing |
Posted: Thu Jan 11, 2007 8:05 am |
|
|
Hello,
I've seen similar problems here in many-many posts, but couldn't find a solution for my problem yet.
I'm trying to use the followings:
---------------------------------------------
void main()
{
int32 address;
int8 count;
int8 buffer[0x100];
address=0;
count=0x40;
read_program_memory(address,buffer,count);
address=0x1000;
count=0x40;
write_program_memory(address,buffer,count);
}
---------------------------------------------
And the call write_program_memory compiles to this:
---------------------------------------------
0024: GOTO 00E0 (RETURN)
.................... write_program_memory(address,buffer,count);
00C6: MOVFF 07,10C
00CA: MOVFF 06,10B
00CE: MOVLB 1
00D0: CLRF x0E
00D2: MOVLW 0B
00D4: MOVWF x0D
00D6: CLRF x10
00D8: MOVFF 0A,10F
00DC: MOVLB 0
00DE: BRA 0024
00E0: SLEEP
---------------------------------------------
funny, isn't it?
processor: 18F45J10
pcwh version: 4.019
Thanks in advance for any info! (even if you draw my attention to a post containing the solution, but slipped my attention)
mfer |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 11, 2007 5:32 pm |
|
|
It worked OK for me. I took your code and dropped it into
a short test program and compiled it with PCH vs. 4.019.
Code: |
#include <18F45J10.h>
#fuses HS, NOWDT
#use delay(clock=20000000)
//====================
void main()
{
int32 address;
int8 count;
int8 buffer[0x100];
address=0;
count=0x40;
read_program_memory(address,buffer,count);
address=0x1000;
count=0x40;
write_program_memory(address,buffer,count);
while(1);
} |
I got the following code in the .LST file:
Code: |
... void main()
... {
0028: CLRF FF8
002A: BCF FD0.7
002C: CLRF FEA
002E: CLRF FE9
0030: MOVF FC1,W
0032: ANDLW C0
0034: IORLW 0F
0036: MOVWF FC1
0038: MOVLW 07
003A: MOVWF FB4
... int32 address;
... int8 count;
... int8 buffer[0x100];
...
... address=0;
003C: CLRF 09
003E: CLRF 08
0040: CLRF 07
0042: CLRF 06
... count=0x40;
0044: MOVLW 40
0046: MOVWF 0A
... read_program_memory(address,buffer,count);
0048: MOVFF 08,FF8
004C: MOVFF 07,FF7
0050: MOVFF 06,FF6
0054: CLRF FEA
0056: MOVLW 0B
0058: MOVWF FE9
005A: MOVLB 1
005C: CLRF x0C
005E: MOVFF 0A,10B
0062: MOVLB 0
0064: BRA 0004
... address=0x1000;
0066: CLRF 09
0068: CLRF 08
006A: MOVLW 10
006C: MOVWF 07
006E: CLRF 06
... count=0x40;
0070: MOVLW 40
0072: MOVWF 0A
... write_program_memory(address,buffer,count);
0074: MOVFF 07,10C
0078: MOVFF 06,10B
007C: MOVLB 1
007E: CLRF x0E
0080: MOVLW 0B
0082: MOVWF x0D
0084: CLRF x10
0086: MOVFF 0A,10F
008A: MOVLB 0
008C: BRA 0024
... while(1);
008E: BRA 008E
... } |
|
|
|
mfer
Joined: 11 Jan 2007 Posts: 8
|
not convinced yet :) |
Posted: Thu Jan 11, 2007 11:43 pm |
|
|
Hello,
You only missed the main part:
what is at 0x0024?
There should be the writing sequence itself.
Did you burn it into the pic and it did the writing properly?
mfer |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 12, 2007 12:55 am |
|
|
You're right. It's not there. I didn't comment out the #nolist when I
posted that reply. I did now, and it's definitely missing the code.
It's not fixed in vs. 4.020 either.
I was going to offer to write a substitute routine for you over the weekend
but I just took a quick look at the data sheet and it appears to be a bit
more complicated than normal in that area. There are more caveats.
The data sheet gives an example of ASM code. It should be possible
to write a routine using that example. I just don't think I have the time
to commit to do it. I have got too much to do on Friday and on Sunday
as well (at work). |
|
|
mfer
Joined: 11 Jan 2007 Posts: 8
|
shall I report it as a bug? |
Posted: Fri Jan 12, 2007 1:04 am |
|
|
Hello,
Do you think I should report it as a bug?
I would be curious to see your replacement code, and next week would be all right.
Thank you for your help so far!!
mfer |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 12, 2007 1:09 am |
|
|
Yes, you should report it.
Actually, I edited my post and revised it a bit in the area of promises
just before you posted your latest response.
Most of my time is already pre-committed on Friday (a customer needs
some boards repaired that day) and I'm supposed to get a schematic
done as well. Sunday is also committed. I can work on it, but it will be
later next week. |
|
|
mfer
Joined: 11 Jan 2007 Posts: 8
|
I'll report it then |
Posted: Fri Jan 12, 2007 1:38 am |
|
|
Hello,
No problem, I will do it from the datasheet, I just was curious to see your solution. You know, one can always learn from others.
mfer |
|
|
mburton Guest
|
|
Posted: Tue Jan 30, 2007 1:47 pm |
|
|
I'm having exactly the same problem with the PIC18F24J10, using compiler 3.249. No error messages or indications at all - very annoying.
Did you get your solution to work? If so, could you post your code fragment?
Thanks.
CCS Technical Support does not monitor this forum on a regular basis. Please do not post bug reports to this form. All bug reports should be emailed to support@ccsinfo.com. Thank you. |
|
|
|