PDA

View Full Version : Can anyone help me to use Writecode for pic18f458 ?



dip1
- 28th June 2006, 15:24
I Used Writecode for pic18F877 and it work OK, but when I used it for Pic18F458 it is not OK. It is not OK for pic18F4580 too.

Please Check this code for pic18f458

W var word
W=$1234
writecode $200,W
writecode $300,W

stop

end

I can check Flash in pic18f458 after writing process in EPIC PROGRAMMER (withaut LCD ..)

Darrel Taylor
- 28th June 2006, 16:23
Hi Dip,

With the 16F877, you can easily write one word at a time to Flash. When the 16F877A came along, you had to write 4 words at a time. And now with the 18F's, you have to write 8 bytes (still 4 words). And some of the newer ones require 16 bytes.

Also with the 877, the chip automatically erases the location being written to. The 18F's have to be erased first, or be writing to locations that were previously erased, or left blank after programming. When erasing 18F's, it erases a block of 64 bytes at a time.

So, if you want to write to Flash at $200, you have to write from $200 to $207.

If instead you wanted to write to $19C, you'd have to write from $198 to $19F.

It actually places the data in "Holding Registers" untill the last byte is recieved. Then it does the write to flash. So unless it gets a byte for the eighth location, it never actually does the write.
<br>

dip1
- 28th June 2006, 18:47
Hello, Darrel
I try to program pic18f458 with code

I var byte ' Loop count
D var word ' Data
A var word ' Address

A=$04F0 '
d=$1234

For I = 0 To 7 '
Writecode A,D '
Next I

stop
end

as You recommended to write , but this code not worked.
Can I program pic18f458 by commands writecode address,data
from picbasicpro2.46 ?
Because writecode must write only 16 bit data, not 8 bit as You recommended
Please write Me a sample of code in pbp2.46 mnemonics.

Darrel Taylor
- 28th June 2006, 19:13
Try this...
I var byte ' Loop count
D var word ' Data
A var word ' Address

A=$04F0
d=$1234

For I = 0 TO 6 STEP 2
Writecode A + I, D
Next I

stop
end

dip1
- 28th June 2006, 22:29
Hi,Darrel

Thanks, Your code is OK!!!!!!!!!!!

Best regards from

Kiev, Ukraine

ps.sorry for bad English