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 support@ccsinfo.com

Writing to 18F452 Flash memory

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







Writing to 18F452 Flash memory
PostPosted: Mon Jun 16, 2003 3:44 am     Reply with quote

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 !!
PostPosted: Mon Jun 16, 2003 7:07 am     Reply with quote

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 !!
PostPosted: Mon Jun 16, 2003 7:43 am     Reply with quote

Maybe it is not a bug, just a new feature Smile.
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 Smile

:=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 !!
PostPosted: Tue Jun 17, 2003 6:26 am     Reply with quote

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
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