Richard,
I tried your suggestion but it did not work.
As my whole code is >73,000 characters it will not post.
I am using PBPX 3.0.7.4
The PIC is a PIC18F27J13.
Is my syntax / technique correct?
Thanks,
Richard,
I tried your suggestion but it did not work.
As my whole code is >73,000 characters it will not post.
I am using PBPX 3.0.7.4
The PIC is a PIC18F27J13.
Is my syntax / technique correct?
Thanks,
what syntax ? at no stage have you posted the relevant config fuse settings you have employed.
why not make a small pgm to test the idea
Richard is asking about config settings where watchdog timer, crystal mode, write protect, etc are all set, and what you are doing there.
The program looks right to me tho I have not used it. Except the output doesn’t absolutely verify what was written, only what read back.
Code:verifya var type ' byte or word verifyb var type ' verified var bit ' EraseCode $1800 ' Whole Block of 4 Words $1800 to $1864? EraseCode $1900 RadioID = RadioID + 1 RadioCH = RadioCH + 1 WriteCode $1803, RadioID ' Writes to 4th Word in Block WriteCode $1903, RadioCH ReadCode $1803, verifya ' Reads from 4th Word in Block ReadCode $1903, verifyb verify = 1 if verifya != RadioID then verified = 0 if verifyb != RadioCh then verified = 0 if verify = 1 then hserout2["RadioID: ", dec RadioID, 13,10] hserout2["RadioCH: ", dec RadioCH, 13,10] else hserout2[“It’s broken :(",13,10] endif
Each PIC controller has different page size that you can WRITE to.
For example if your chip has 64 words page, then you have to read all 64 words, change what you want, then write back the whole 64 words page.
It is a bit clumsy but that is how it works. You cannot change only the words you really want. And if you write less tat the page size, then data will not be written!
So, my suggestion is to make an array, get the page form Flash, make the changes, then store back to Flash the array.
Ioannis
Or, if reading/writing to a whole page of flash program memory does not appeal to you.
You can always switch to a PIC model that has internally EEPROM or add an external Serial EEPROM.
![]()
Regards,
TABSoft
Ioannis,
This is getting more complicated than I figured.
Might you be available to implement this for a fee?
I can send you money in advance via PayPal.
Thanks,
Jay Zebryk
Zebryk Engineering
Southbridge, Massachusetts
I would also suggest adding an external I2C serial eeprom of small size and using it to store your data. Something as small as an 24LC01 1K device.
Dave Purola,
N8NTA
EN82fn
Zebryk,
1. how many times will your write new values to flash? Flash has less durabilit than EEPROM.
2. how many words will you store to flash? Think ahead in the future.
3. Are you sure that the address you have chosen will be free?
Ioannis
P.S. No fee necessary, we are here to help each other!Look at your P.M. also.
Bookmarks