hello, I wrote a pretty complex program and have compiled it for other chips and simulated it in proteus, and the program works perfect. when I changed to the chip that i have, which is the 16f1826 the compiler complains of a-d.set problems (as if the chip doesnt have an a-d converter which i know according to the datasheet it has a 10 channel converter) and it complains of the program being too big, which the program size of the chip is 2k words, and the other chip which i had been simulating on was also 2k words, so since it fit in that chip it should fit into the 16f1826. the chip i was simulating on was the 16f677 because it has a similar number of pins that i need. the pins i need are 3 for analog, 3 digital outputs, 3 digital inputs, and a software serial rx/tx, so a total of 11. oh and an eprom for non volitile settings to be saved inside of. i also have a 16f616 but that doesnt appear to have an eprom which i need. i dont know why great cow graphical basic complains of the program size being too big for this chip and why it acts like theres no analog. am i just overlooking something? is there a setting in the hardware settings section i should be setting, or maybe not setting? any help would be great i would love to get this working.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
and none of those pins say they're analog. so im gonna back up that file and try to put those values in manually and see what terrible things happen. this may be something to look into though it seems im the only one who uses this chip, which i only bought because it was cheap, had all the pins i needed and all the analog inputs i wanted and (so i thought) was fully supported by GCB. ill report my results
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
looking through a-d.c i see theres a section that say "#IFDEF NoBit(ANS0)" and in the file 16f1826 it says ANSA0,ANSELA,0
so maybe what the file a-d.c is missing is the letter A, but theres also ANSB1,ANSELB,1 and in the a-d.h file theres ANSELH
so where would i put the B and where would i put the A. do I replace ANSELH with ANSELA and ANSEL with ANSELB? or am i still on the wrong track. i really dont know how to program in C so im really just guessing based on the differences in the files 16f677.dat and 16f1826.dat because if i put the contents of 16f677.dat into 16f1826.dat it doesnt complain of the AD problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reading through the a-d.h include file, I saw the following warning that some PIC18's have an error in A-D chip definition. Could that be your problem?:
'Some 18F8xxxx chips have error in chip definition
'They claim to have PCFG4, but actually don't, can spot them by presence of ADCON2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
well that seems to be the right track, i removed instances of pcfg from a-d.c and it doesnt give the a-d complaints, but this isnt a fix just shows where the problem is. like i said i dont know how to program in c and i dont know how to program in assembly. im more on the beginner side of pic programming. so if someone can point me in the right direction maybe i can replace the incorrect parts of the code, but i really dont know where to begin. i get a total of 6 complaints of "error in library a-d.h: incorrect parameters in set, expected: set variable.bit status" so im guessing theres a total of 6 instances of pcfg in the a-d.c library. i mean i could probably use the POT command but i think that would make my code larger (its pushing the limits as it is) and plus i dont want to waste the a/d periferals of my chip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok i got that problem under control, i just downloaded the update.zip, replaced the old a-d.c file with the updated one and of course now im on a whole new course of errors, like EEDATA has not been defined which ill now be trying to troubleshoot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 19/07/2011 version of GCBasic has a section in the a-d.h file for the 16F1826. Are you using that version?
You may find that the program compiles to a larger size than the earlier chip as there could be more banksels needed and the A-D code compiles longer as well as the code to set the port pins to analogue is a lot bigger.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yes i am using the newer file with the section for my chip, i no longer get any errors related to the analog inputs, but the problems i am now running into are writing to the eeprom of the chip and all my variables are giving me errors. here is a small list of the errors i now receive
GCASM: Symbol EEDATA has not been defined
GCASM: Symbol LOOP_COUNTER_H has not been defined
and it lists 3 more of my variables with _H after them (loop_counter) is one of the variables Im using, and as for the eeprom it doesnt appear in the 16f1826.dat file and it does appear in the 16f677.dat i think this is because the chip im using has the self write function and writes to the eeprom in a different way. thanks for all the help by the way i feel im getting closer to getting this program ready for the chip so i can finally start designing the hardware part
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a modified version of eeprom.h with a messy fix for EEDATA being renamed as EEDATL in the 1826.
' 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#IFDEFVar(EEDATL)DimEEDataValueAliasEEDATL#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 #IFDEF Var(EEDATL) Dim EEDataValue Alias EEDATL #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#IFDEFVar(EEDATL)DimEEDataValueAliasEEDATL#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#IFDEFVar(EEDATL)DimEEDataWordAsWordAliasEEDATH,EEDATL#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#IFDEFVar(EEDATL)DimEEDataWordAsWordAliasEEDATH,EEDATL#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:
oh wow thanks that fixed my eeprom problem, last problem is with my variables claiming to not be defined. im not sure why it puts the _H after the name of my variable in the errors
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There's a problem with the way GCBasic handles array indexing on the enhanced 16F chips that should probably go in the compiler problems forum. It always treats the index as a word variable even if its a byte variable which is why you are getting the _H not defined error.
You could try 'dim'ing them as word variables if that won't break other parts of your program although the size of the code will probably balloon.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok that makes sence, just before your reply i had tryed changing those variables to words because of another post i had read and that solved my problem, but did tell me my program was too large, just as you predicted. looks like ill be doing some fat trimming on my code to try to fit it all on this tiny chip. thanks so much for all your help you solved every one of my problems
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello, I wrote a pretty complex program and have compiled it for other chips and simulated it in proteus, and the program works perfect. when I changed to the chip that i have, which is the 16f1826 the compiler complains of a-d.set problems (as if the chip doesnt have an a-d converter which i know according to the datasheet it has a 10 channel converter) and it complains of the program being too big, which the program size of the chip is 2k words, and the other chip which i had been simulating on was also 2k words, so since it fit in that chip it should fit into the 16f1826. the chip i was simulating on was the 16f677 because it has a similar number of pins that i need. the pins i need are 3 for analog, 3 digital outputs, 3 digital inputs, and a software serial rx/tx, so a total of 11. oh and an eprom for non volitile settings to be saved inside of. i also have a 16f616 but that doesnt appear to have an eprom which i need. i dont know why great cow graphical basic complains of the program size being too big for this chip and why it acts like theres no analog. am i just overlooking something? is there a setting in the hardware settings section i should be setting, or maybe not setting? any help would be great i would love to get this working.
i may have found the problem with GC not accepting my chip has Analog inputs. in the 16f1826.dat file the pins show this
17,RA0(IO)
18,RA1(IO)
1,RA2(IO)
2,RA3(IO)
3,RA4(IO)
4,RA5(I),MCLR
15,RA6(IO),OSC2
16,RA7(IO),OSC1
6,RB0(IO)
7,RB1(IO)
8,RB2(IO)
9,RB3(IO)
10,RB4(IO)
11,RB5(IO)
12,RB6(IO)
13,RB7(IO)
5,Vss
14,Vdd
and none of those pins say they're analog. so im gonna back up that file and try to put those values in manually and see what terrible things happen. this may be something to look into though it seems im the only one who uses this chip, which i only bought because it was cheap, had all the pins i needed and all the analog inputs i wanted and (so i thought) was fully supported by GCB. ill report my results
well that didnt help, im still gettings "error in library a-d.h: incorrect parameters in set, expected: set variable.bit status
looking through a-d.c i see theres a section that say "#IFDEF NoBit(ANS0)" and in the file 16f1826 it says ANSA0,ANSELA,0
so maybe what the file a-d.c is missing is the letter A, but theres also ANSB1,ANSELB,1 and in the a-d.h file theres ANSELH
so where would i put the B and where would i put the A. do I replace ANSELH with ANSELA and ANSEL with ANSELB? or am i still on the wrong track. i really dont know how to program in C so im really just guessing based on the differences in the files 16f677.dat and 16f1826.dat because if i put the contents of 16f677.dat into 16f1826.dat it doesnt complain of the AD problem.
Reading through the a-d.h include file, I saw the following warning that some PIC18's have an error in A-D chip definition. Could that be your problem?:
'Some 18F8xxxx chips have error in chip definition
'They claim to have PCFG4, but actually don't, can spot them by presence of ADCON2
well that seems to be the right track, i removed instances of pcfg from a-d.c and it doesnt give the a-d complaints, but this isnt a fix just shows where the problem is. like i said i dont know how to program in c and i dont know how to program in assembly. im more on the beginner side of pic programming. so if someone can point me in the right direction maybe i can replace the incorrect parts of the code, but i really dont know where to begin. i get a total of 6 complaints of "error in library a-d.h: incorrect parameters in set, expected: set variable.bit status" so im guessing theres a total of 6 instances of pcfg in the a-d.c library. i mean i could probably use the POT command but i think that would make my code larger (its pushing the limits as it is) and plus i dont want to waste the a/d periferals of my chip
ok i got that problem under control, i just downloaded the update.zip, replaced the old a-d.c file with the updated one and of course now im on a whole new course of errors, like EEDATA has not been defined which ill now be trying to troubleshoot
The 19/07/2011 version of GCBasic has a section in the a-d.h file for the 16F1826. Are you using that version?
You may find that the program compiles to a larger size than the earlier chip as there could be more banksels needed and the A-D code compiles longer as well as the code to set the port pins to analogue is a lot bigger.
yes i am using the newer file with the section for my chip, i no longer get any errors related to the analog inputs, but the problems i am now running into are writing to the eeprom of the chip and all my variables are giving me errors. here is a small list of the errors i now receive
GCASM: Symbol EEDATA has not been defined
GCASM: Symbol LOOP_COUNTER_H has not been defined
and it lists 3 more of my variables with _H after them (loop_counter) is one of the variables Im using, and as for the eeprom it doesnt appear in the 16f1826.dat file and it does appear in the 16f677.dat i think this is because the chip im using has the self write function and writes to the eeprom in a different way. thanks for all the help by the way i feel im getting closer to getting this program ready for the chip so i can finally start designing the hardware part
Here is a modified version of eeprom.h with a messy fix for EEDATA being renamed as EEDATL in the 1826.
oh wow thanks that fixed my eeprom problem, last problem is with my variables claiming to not be defined. im not sure why it puts the _H after the name of my variable in the errors
Are the variables with _H being used as indexes into tables or arrays?
yes, there are 3 variables i am using as indexes for an array, and it also complains about that array
There's a problem with the way GCBasic handles array indexing on the enhanced 16F chips that should probably go in the compiler problems forum. It always treats the index as a word variable even if its a byte variable which is why you are getting the _H not defined error.
You could try 'dim'ing them as word variables if that won't break other parts of your program although the size of the code will probably balloon.
ok that makes sence, just before your reply i had tryed changing those variables to words because of another post i had read and that solved my problem, but did tell me my program was too large, just as you predicted. looks like ill be doing some fat trimming on my code to try to fit it all on this tiny chip. thanks so much for all your help you solved every one of my problems