|
|
View previous topic :: View next topic |
Author |
Message |
SebDey Guest
|
Writing to 18F452 Flash memory |
Posted: Mon Jun 16, 2003 3:44 am |
|
|
Hello,
I'm not able to write to the program memory of my pic18f452 and don't know why. I'm using the built-in function WRITE_PROGRAM_MEMORY(...) but it has no effects (No change in device code). Perhaps a problem with the variables I'm using,.. but I really have no idea of what I'm doing wrong.
Here's my code, Im using PCH compiler v.3.129.
#include <18F452.h>
#fuses HS,NOWDT,NOBROWNOUT,NOLVP,NOPROTECT,WRT,WRTD,PUT,NOCPD,NOEBTR
#use delay(clock=20000000)
#define CPF 0x02
#define T_TYPE_ADDR 0x07E02
(...)
int count=getenv("FLASH_WRITE_SIZE"),data_to_write[8];
int32 address_to_write;
(...)
data_to_write[0]=CPF;
address_to_write=T_TYPE_ADDR;
write_program_memory(address_to_write,data_to_write,count);
(...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515283 |
|
|
SebDey Guest
|
!! BUG FOUND IN PCH V 3.129 !! |
Posted: Mon Jun 16, 2003 7:07 am |
|
|
In fact, there's a BUG in my version of PCH compiler (3.129), you have to specify NOWRT (!?) in order to have the config6L config. register set to the correct values for allowing writes to FLASH memory (By the way, specifying WRT will protect the FLASH from writes...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515292 |
|
|
Tomi Guest
|
Re: !! BUG FOUND IN PCH V 3.129 !! |
Posted: Mon Jun 16, 2003 7:43 am |
|
|
Maybe it is not a bug, just a new feature .
From the fuses.txt:
"
..........
NOWRT Program memory not write protected
..........
WRT Program Memory Write Protected
..........
"
So maybe WRT is not "WRiTe" but "WRite protecT" what is a not too lucky name convention
:=In fact, there's a BUG in my version of PCH compiler (3.129), you have to specify NOWRT (!?) in order to have the config6L config. register set to the correct values for allowing writes to FLASH memory (By the way, specifying WRT will protect the FLASH from writes...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515296 |
|
|
SebDey Guest
|
Re: !! BUG FOUND IN PCH V 3.129 !! |
Posted: Tue Jun 17, 2003 6:26 am |
|
|
Maybe you're right, but it's confusing because in the 'valid fuses' menu, you've got:
WRT Allow programs to write to flash
NOWRT No writting to flash from a program
anyway, my problem is over now, and I hope that it'll be useful for someone to know this 'problem'
Thanks
SebD
:=Maybe it is not a bug, just a new feature <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">.
:=From the fuses.txt:
:="
:=..........
:=NOWRT Program memory not write protected
:=..........
:=WRT Program Memory Write Protected
:=..........
:="
:=So maybe WRT is not "WRiTe" but "WRite protecT" what is a not too lucky name convention <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">
:=
:=:=In fact, there's a BUG in my version of PCH compiler (3.129), you have to specify NOWRT (!?) in order to have the config6L config. register set to the correct values for allowing writes to FLASH memory (By the way, specifying WRT will protect the FLASH from writes...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515318 |
|
|
|
|
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
|