I have just tried to program the chip with the 'updated' eeprom.h… does not work.
Programming…
The following memory regions failed to program correctly:
EEData Memory
Address: 00000000 Expected Value: 000000ff Received Value: 00000056
Help please. How do I correct the eeprom.h?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Which updated eeprom.h are you using from the forum?
EEDATA has been renamed in the 16F18xx series of chips to EEDAT or EEDATL. I've used the following eeprom.h code on a 16F1947 that also has the same name change.
' EEPROM routines for Great Cow BASIC'Copyright(C)2006-2007HughConsidine' This library is free software; you can redistribute it and/or'modifyitunderthetermsoftheGNULesserGeneralPublic' License as published by the Free Software Foundation; either'version2.1oftheLicense,or(atyouroption)anylaterversion.' This library is distributed in the hope that it will be useful,'butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU'LesserGeneralPublicLicenseformoredetails.' You should have received a copy of the GNU Lesser General Public'Licensealongwiththislibrary;ifnot,writetotheFreeSoftware' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA'********************************************************************************'IMPORTANT:'THISFILEISESSENTIALFORSOMEOFTHECOMMANDSINGCBASIC.DONOTALTERTHISFILE'UNLESS YOU KNOW WHAT YOU ARE DOING. CHANGING THIS FILE COULD RENDER SOME GCBASIC'COMMANDSUNUSABLE!'********************************************************************************'Updates:' 3/5/2006: Program EEPROM read/write added'16/5/2006: WritemodedisabledatendofEPWrite' 23/5/2006: EPWrite and EPRead changed to stop use of temporary vars'19/8/2006: ProgramEEPROMalteredtotakeinputasword' 9/2/2007: Bug fix: EEPGD bit not set if not present'5/8/2007: Alteredtousealiastoaccessaddress,datavars' 4/9/2007: Data EEPROM code altered to support AVR'15/10/2007: Bugfix: FREEbitnotsetifnotpresent,alteredtouseIntOn/IntOfftocontrolinterrupt' 4/12/2007: Added In/Out to parameters'17/6/2008: AlteredtomakeEPReadasystemsub,toallowuseinReadTable' 19/4/2009: Bugfixes for AVR, allow EEPE instead of EEWEsub EPWrite(In EEAddress, In EEDataValue)#IFDEF PIC 'Variablealias#IFNDEFVar(EEADRH)DimEEAddressAliasEEADR#ENDIF#IFDEFVar(EEADRH)DimEEAddressAsWordAliasEEADRH,EEADR#ENDIF#IFDEFVar(EEDATA)DimEEDataValueAliasEEDATA#ENDIF#IFNDEFVar(EEDATA)#IFDEFVar(EEDATL)DimEEDataValueAliasEEDATL#ENDIF#ENDIF'Disable interrupt IntOff 'Selectdatamemory#IFDEFBit(EEPGD)SETEECON1.EEPGDOFF#ENDIF#IFDEFBit(CFGS)SetEECON1.CFGSOFF#ENDIF'Start write SET EECON1.WREN ON EECON2 = 0x55 EECON2 = 0xAA SET EECON1.WR ON SET EECON1.WREN OFF 'WaitforwritetocompleteWAITWHILEEECON1.WRONSETEECON1.WRENOFF'Restore interrupt IntOn#ENDIF#IFDEF AVR 'Variablealias#IFDEFVar(EEARH)DimEEAddressAsWordAliasEEARH,EEARL#ENDIF#IFNDEFVar(EEARH)#IFDEFVar(EEAR)DimEEAddressAliasEEAR#ENDIF#ENDIFDimEEDataValueAliasEEDR'Enable write #IFDEF Bit(EEMWE) Set EECR.EEMWE On #ENDIF #IFNDEF Bit(EEMWE) #IFDEF Bit(EEMPE) Set EECR.EEMPE On #ENDIF #ENDIF 'Startwrite,waitforittocomplete#IFDEFBit(EEWE)SetEECR.EEWEOnWaitUntilEECR.EEWEOff#ENDIF#IFNDEFBit(EEWE)#IFDEFBit(EEPE)SetEECR.EEPEOnWaitUntilEECR.EEPEOff#ENDIF#ENDIF#ENDIFendsub'EPRead made into system subroutine'ConstantaddedtoallowittostillbereferredtoasEPRead#defineEPReadSysEPReadsubSysEPRead(InEEAddress,OutEEDataValue)#IFDEFPIC'Variable alias #IFNDEF Var(EEADRH) Dim EEAddress Alias EEADR #ENDIF #IFDEF Var(EEADRH) Dim EEAddress As Word Alias EEADRH, EEADR #ENDIF #IFDEF Var(EEDATA) Dim EEDataValue Alias EEDATA #ENDIF #IFNDEF Var(EEDATA) #IFDEF Var(EEDATL) Dim EEDataValue Alias EEDATL #ENDIF #ENDIF 'DisableinterruptIntOff'Select data memory #IFDEF Bit(EEPGD) SET EECON1.EEPGD OFF #ENDIF #IFDEF Bit(CFGS) Set EECON1.CFGS OFF #ENDIF 'ReadSETEECON1.RDON'Restore interrupt IntOn#ENDIF#IFDEF AVR 'Variablealias#IFDEFVar(EEARH)DimEEAddressAsWordAliasEEARH,EEARL#ENDIF#IFNDEFVar(EEARH)#IFDEFVar(EEAR)DimEEAddressAliasEEAR#ENDIF#ENDIFDimEEDataValueAliasEEDR'Start read Set EECR.EERE On#ENDIF end subfunction ReadEP(EEAddress)#IFDEF PIC 'Variablealias#IFNDEFVar(EEADRH)DimEEAddressAliasEEADR#ENDIF#IFDEFVar(EEADRH)DimEEAddressAsWordAliasEEADRH,EEADR#ENDIF#IFDEFVar(EEDATA)DimEEDataValueAliasEEDATA#ENDIF#IFNDEFVar(EEDATA)#IFDEFVar(EEDATL)DimEEDataValueAliasEEDATL#ENDIF#ENDIF'Disable interrupt IntOff 'Selectdatamemory#IFDEFBit(EEPGD)SETEECON1.EEPGDOFF#ENDIF#IFDEFBit(CFGS)SetEECON1.CFGSOFF#ENDIF'Read SET EECON1.RD ON ReadEP = EEDataValue 'RestoreinterruptIntOn#ENDIF#IFDEFAVR'Variable alias #IFDEF Var(EEARH) Dim EEAddress As Word Alias EEARH, EEARL #ENDIF #IFNDEF Var(EEARH) #IFDEF Var(EEAR) Dim EEAddress Alias EEAR #ENDIF #ENDIF Dim EEDataValue Alias EEDR 'StartreadSetEECR.EEREOn#ENDIFendfunctionsubProgramWrite(InEEAddress,InEEDataWord)#IFDEFPICDimEEAddressAsWordAliasEEADRH,EEADR#IFDEFVar(EEDATA)DimEEDataWordAsWordAliasEEDATH,EEDATA#ENDIF#IFNDEFVar(EEDATA)#IFDEFVar(EEDATL)DimEEDataWordAsWordAliasEEDATH,EEDATL#ENDIF#ENDIF'Disable Interrupt IntOff 'SelectprogrammemorySETEECON1.EEPGDON#IFDEFBit(CFGS)SetEECON1.CFGSOFF#ENDIF'Enable write SET EECON1.WREN ON #ifdef bit(FREE) SET EECON1.FREE OFF #endif 'WriteenablecodeEECON2=0x55EECON2=0xAA'Start write, wait for it to finish SET EECON1.WR ON NOP NOP SET EECON1.WREN OFF 'EnableInterruptIntOn#ENDIFendsubsubProgramRead(InEEAddress,OutEEDataWord)DimEEAddressAsWordAliasEEADRH,EEADR#IFDEFVar(EEDATA)DimEEDataWordAsWordAliasEEDATH,EEDATA#ENDIF#IFNDEFVar(EEDATA)#IFDEFVar(EEDATL)DimEEDataWordAsWordAliasEEDATH,EEDATL#ENDIF#ENDIF'Disable Interrupt IntOff 'SelectprogrammemorySETEECON1.EEPGDON#IFDEFBit(CFGS)SetEECON1.CFGSOFF#ENDIF'Start read, wait for it to finish SET EECON1.RD ON NOP NOP 'EnableinterruptIntOnendsubsubProgramErase(InEEAddress)DimEEAddressAsWordAliasEEADRH,EEADR'Disable Interrupt IntOff 'SelectprogrammemorySETEECON1.EEPGDON#IFDEFBit(CFGS)SetEECON1.CFGSOFF#ENDIFSETEECON1.WRENON#ifdefbit(FREE)SETEECON1.FREEON#endifEECON2=0x55EECON2=0xAASETEECON1.WRONNOPNOP#ifdefbit(FREE)SETEECON1.FREEOFF#endifSETEECON1.WRENOFF'EnableinterruptIntOnendsub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get an error when compiling. EEDATA not defined error.
I have used one of the updated eeprom.h files from the forum.
Would it be possible to include a revised eeprom.h in the next release?
I have just tried to program the chip with the 'updated' eeprom.h… does not work.
Programming…
The following memory regions failed to program correctly:
EEData Memory
Address: 00000000 Expected Value: 000000ff Received Value: 00000056
Help please. How do I correct the eeprom.h?
Which updated eeprom.h are you using from the forum?
EEDATA has been renamed in the 16F18xx series of chips to EEDAT or EEDATL. I've used the following eeprom.h code on a 16F1947 that also has the same name change.
Thank you, this works.
I am very grateful.
Evan
Resolved.