Hugh, I get this error message :Error: Program is too large, cannot fit all subroutines into available program memory
Compiled with version: Great Cow BASIC (0.9 19/7/2011)
Attached is the program. If you comment out Line 103 (HPWM 1, 1, Heatpower) the error goes away. The program is only using half the memory, Any Ideas?
Thanks, Ed.
'Chip model#chip 16F88, 8 'PicmodelandclockMHz#configINTRC_IO'Use internal OscillatorOsctune = b'111110' 'worksfrom111000to000011'Set the pin directionsdir portA.0 In 'Coldpin17dirportA.1In'Hot pin 18dir portA.2 In 'AmbientTemppin1dirportA.3Out'Heater pin 2dir portA.4 Out 'Pumppin3dirportB.0Out'PWM pin 6 used to heat snow sensordir portB.1 In 'ManualHeatmodepin7dirportB.2In'Snow pin 8dir PortB.3 Out 'TestportPin9dirportB.4In'Manual Circulate Mode Pin 10dir portB.5 Out 'LCDpin11'set defines#define SendAHigh Set PORTB.5 Off 'NotePolarityfor4X20Newhavendisplay#defineSendALowSetPORTB.5On#defineColdAn0#defineHotAn1#defineTempAn2#defineHeaterPortA.3#definePumpPortA.4#defineManualModePortB.1#defineSnowPortB.2#defineTestPortB.3#defineManualCircPortB.4#defineLCDPortB.5dimAmbientTasintegerdimWaterinTasintegerdimWateroutTasintegerdimAmbientTempasworddimE_timeminasworddimDeltaTasworddimDisplayAmbTasworddimDisplayinTasworddimDisplayoutTasworddimWaterinTempasworddimWateroutTempasworddimMeltTime_sasworddimMeltTime_masworddimMeltTime_Lasword'Set inital parametersInitSer 1, r2400, 1, 8, 1, none, invert 'LCDinterfacePositivegoingStandbybit2400baudSetLCD=On'Init LCDwait 200 msOption_reg.7 = off 'EnableWPUHeatPower=112'Set heater powerMeltTime_s = 0 'ZeroMelttimesMeltTime_m=0MeltTime_L=0E_timesec=0'Zero Elapsed timesE_timemin = 0Standby: Set Pump = Off 'TurnsystemOffSetHeater=On'Keep heater on to defrost PWMOff 'TurnoffthePWMSetportB.0=Off'Turn off Port E_timesec = 0 'ZeroElapsedtimesE_timemin=0Ambient=ReadAD(Temp)'Read Ambient air sensor ReadTable Tconvert, Ambient, AmbientTemp 'LookuptemeperaturevalueAmbientT=AmbientTemp-80'Correct for lack of negiative numbers in table call ReadWater 'CheckWaterTempcallStandbyDisplay'Refresh display Count = 0 'ZeroWritecounterforEEpromwriterIfManualMode=OffthenGotoManual'Goto manual mode If ManualCirc = Off then Goto Circ 'GotocirculatemodeIfSnow=OnthenGotoHeat'Goto heat mode If AmbientT > -25 then Goto Standby 'BypassfluidmeasurementSetHeater=OffSetPump=On'Circulate water to measure WaterinT wait 60 s Set Pump = Off Set Heater = On call ReadWater ` 'ReadwatertemperatureIfAmbientT<-25andWaterinT<-15thenGotoWarm'Keep unit off for as long as possible 'Wait1h'Do hourlyGoto Standby'SubsManual:'Turn on system Checked 08-09-11 Call TurnOns Set Pump = On Set Heater = On HPWM 1, 1, Heatpower 'TurnonheateronsnowsensorIfSnow=OnthenMeltTime_s+=1'record melt time MeltTime_m = MeltTime_s/60 EPWrite 255, MeltTime_m 'RecordmelttimecallElapsed_time'Measure on time call ReadWater 'ReadwatertemperaturecallManualDisplay'Refresh display call Write 'MeasureDeltaTin10minintervalsandwritetoEEpromIfManualMode=OnthenGotoStandbyWait713msGotoManualCirc:'Turn on system Checked? Set Pump = On Set Heater = Off call Elapsed_time 'MeasureontimecallReadWater'Read water temperature call CircDisplay 'RefreshdisplayIfManualCirc=OnthenGotoStandbyWait713msGotoCircHeat:'Checked 08-09-11 Call TurnOns Set Pump = On 'TurnonsystemSetHeater=On'HPWM 1, 1, Heatpower 'TurnonheateronsnowsensorIfSnow=OnthenMeltTime_s+=1'record melt time MeltTime_m = MeltTime_s/60 EPWrite 255, MeltTime_m 'RecordmelttimecallElapsed_time'Measure on time call ReadWater 'ReadwatertemperaturecallHeatDisplay'Refresh display call Write 'MeasureDeltaTin10minintervalsandwritetoEEpromIfSnow=Offthen'Clear snow and wait 30 min. Wait 30 m goto Standby End If Wait 745 msGoto HeatWarm: 'Checked08-09-11SetPump=On'Turn on system Set Heater = On call ReadWater 'ReadwatertemperaturecallWarmDisplay'Refresh display if WaterinT > 0 then goto Standby 'WarmupwaterthenturnoffWait753msGotoWarmSubManualDisplaycallClearserprint1,"Mode:"serprint1,"Man"serprint1," T"Serprint1,MeltTime_mSerprint1,"m"callCommonDisplayReturnSubCircDisplaycallClearserprint1,"Mode:"serprint1,"Circ"callCommonDisplayReturnSubStandbyDisplaycallClearserprint1,"Mode:"serprint1,"Sby"EPRead255,MeltTime_LSerprint1," MTime:"'Read melt time Serprint 1, MeltTime_L call CommonDisplay Wait 1 sReturnSub WarmDisplay call Clear call First serprint 1, "Mode:" serprint 1, "Warm" call CommonDisplayReturnSub HeatDisplay call Clear call First serprint 1, "Mode:" serprint 1, "Heat" call CommonDisplayReturnSub CommonDisplay call second call Elapsed_time 'Measureontimeserprint1,"Ambient:"IfAmbientT_H.7=OnthenDisplayAmbT=65536-AmbientTElseDisplayAmbT=AmbientTEndIfIfAmbientT_H.7=Onthenserprint1,"-"serprint1,DisplayAmbTElseserprint1,DisplayAmbTEndIfserprint1," ET:"serprint1,E_timeminserprint1,"m"callThirdIfWaterin<52thenDisplayinT=65536-WaterinTElseDisplayinT=WaterinTEndIfserprint1,"WIn:"IfWaterIn<52thenserprint1,"-"serprint1,DisplayinTElseserprint1,DisplayinTEndIfcallFourthserprint1,"WOut:"IfWaterout<52thenDisplayoutT=65536-WateroutTElseDisplayoutT=WateroutTEndIfIfWaterout<52thenserprint1,"-"serprint1,DisplayoutTElseserprint1,DisplayoutTEndIfEPRead254,Tonsserprint1," Tons:"serprint1,Tons'wait 1 sReturnSub ReadWater Waterin = ReadAD (cold) ReadTable Tconvert, Waterin, WaterinTemp WaterinT = WaterinTemp - 80 Waterout = ReadAD (hot) ReadTable Tconvert, Waterout, WateroutTemp WateroutT = WateroutTemp - 80ReturnSub Elapsed_time E_timesec += 1 'SecondsIfE_timesec=60thenE_timesec=0E_timemin+=1'Minutes end ifReturnSub Write DeltaT = WateroutT - WaterinT EPWrite 0, DeltaT 'StorefirstDeltaTmeasurementIfE_timemin%10=0then'Measure DeltaT in 10 min intervals and write to EEprom Count += 1 EPWrite Count, DeltaT End IfReturnSub TurnOns TurnOn +=1 EPWrite 254, TurnOnReturnSub TestDisplayCall Clear serprint 1, "First line" Call second Serprint 1, "Second line" Call Third Serprint 1, "Third line" Call fourth Serprint 1, "Fourth line" wait 1 sReturn'Displayutilities'NewHaven Display utilitiesSub Clear sersend 1, 254 'startCMDsersend1,81'clear screenReturnSub First sersend 1, 254 'startCMDsersend1,69'First line sersend 1, 0ReturnSub Second sersend 1, 254 'startCMDsersend1,69'second line sersend 1, 64ReturnSub Third sersend 1, 254 'startCMDsersend1,69'Third line sersend 1, 20ReturnSub Fourth sersend 1, 254 'startCMDsersend1,69'Fourth line sersend 1, 84ReturnSub Baud '1=300,2=1200,3=2400,4=9600,5=14.4k.6=19.2k,7=57.6k,8=115.2ksersend1,254'start CMD sersend 1, 97 'baudselectsersend1,4'9600- wait 100 usReturnTable Tconvert 'GCBcanonlyhandlepositivevaluesmustsubtract80forcorrectvalues024579111213141618202223242527293132343637384041434547495051525456585961626365676870727475767779818385868788909294959799100101103104106108110112113114115117119121122124125126128130131133135137138139140142144146148149150151153155157158160162163164166167169171173175176177178180182184185187189190191193194196198200201202203205207209211212213214216218220221223225225227229230232234236238238239241243245247248250251252254256257259261263263265266268270272274275275277279281283284286287288290292293295297299300301302304306308310311312313315317319320322324326326328329331333335337338338340342344346347349350351353355356358360362364364365367369371373374376376378380382383385387389389391392394396398400EndTable/code][code]SOMETHINGHERE[/code]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hugh, I get this error message :Error: Program is too large, cannot fit all subroutines into available program memory
Compiled with version: Great Cow BASIC (0.9 19/7/2011)
Attached is the program. If you comment out Line 103 (HPWM 1, 1, Heatpower) the error goes away. The program is only using half the memory, Any Ideas?
Thanks, Ed.