PDA

View Full Version : WRITE data to EEPROM on PIC18F8621



dschafer
- 8th March 2007, 21:05
Has anyone had experiance using READ and WRITE on the 18F8621. Using READ I can read the values stored in the EEPROM but I cannot WRITE new values to the internal EEPROM. Why is this? It works on the 16F devices I used in the past.

I guess this is probably not spacific to this device and assume its due to the migration from 16f to 18f.

skimask
- 8th March 2007, 23:07
Has anyone had experiance using READ and WRITE on the 18F8621. Using READ I can read the values stored in the EEPROM but I cannot WRITE new values to the internal EEPROM. Why is this? It works on the 16F devices I used in the past.

I guess this is probably not spacific to this device and assume its due to the migration from 16f to 18f.

What version of PBP?

dschafer
- 8th March 2007, 23:52
PicBasicPro version 2.4.6.0

skimask
- 9th March 2007, 00:04
PicBasicPro version 2.4.6.0

Show us the program that's failing you...

dschafer
- 9th March 2007, 00:35
Show us the program that's failing you...

Its a long program, but what i'm trying to do using READ and WRITE is as follows:

'at the start of the program read these values from EEPROM and place in the variables'

Read 0, trip_amount[0]
Read 1, trip_amount[1]

'so far so good, this works as per usual'

If S1 = 1 Then
Read 0, temperary[0]
Read 1, temperary[1]
If (trip_amount[0] <> temperary[0]) OR (trip_amount[1] <> temperary[1]) Then
Write 0, trip_amount[0]
Write 1, trip_amount[1]
LCDOut $FE, 1
LCDOut $FE, $C0 , " SAVING CHANGES"
Pause 1000
EndIf
Goto Menue_2_0
EndIf

'I get a SAVING CHANGES on the LCD but the eeprom values dont change'

skimask
- 9th March 2007, 01:11
well that should work fine, must be something in the rest of the program that isn't being shown, maybe a variable declaration, changing the variable itself in another part of the program, etc.etc.

dschafer
- 9th March 2007, 01:21
No, that is not the case, I have checked over the code many times.

One thing I did notice is when I program the PIC the fuse settings for 'EEPROM table write protect' and 'CONFIG table write protect' are both DISABLED, But when I read the HEX, EEPROM, and fuse data back to the PIC programer both of those setting are ENABLED.

mister_e
- 9th March 2007, 01:27
High likely it's down to your PIC programmer. Which one?

dschafer
- 9th March 2007, 01:30
High likely it's down to your PIC programmer. Which one?

I use the DIY K128 v141204

mister_e
- 9th March 2007, 01:32
and which software?

skimask
- 9th March 2007, 01:36
No, that is not the case, I have checked over the code many times.

Of course it's never the program writer's fault, is it? :)


One thing I did notice is when I program the PIC the fuse settings for 'EEPROM table write protect' and 'CONFIG table write protect' are both DISABLED, But when I read the HEX, EEPROM, and fuse data back to the PIC programer both of those setting are ENABLED.

So set them so that the 'protect' options are enabled, read them back, see if they're disabled, and try the program again. Maybe the software for the programmer is bass-ackwards...

dschafer
- 9th March 2007, 01:38
and which software?

MPLAB IDE v7.21

The K128 programer has its own software

mister_e
- 9th March 2007, 01:41
maybe it worth to visit their forum and ask?
http://www.websitetoolbox.com/tool/mb/diykit

dschafer
- 9th March 2007, 01:50
maybe it worth to visit their forum and ask?
http://www.websitetoolbox.com/tool/mb/diykit

I think you're on the right track.

Just tried loading the program again, both settings disabled.
did not power up the PIC
read rom, eeprom, fuse data, and both setting are already enabled.

also tried inverting these settings as you sugested but they read the same (enabled)

will look further at the programmer K128 possibly require updated firmware.

Thanks for all the help, will let you know how I go.

dschafer
- 13th March 2007, 02:09
Thanks very much for your help. You leed me in the right direction, the direction of the programmer itself. The DIY K128 programmer had a small bug. Installing DIYpack26b2 has fixed the problem.

PS. Still very happy with the programmer, its a great unit!