I am getting a strange error message associated with the PWMoff command. If I try to comment out line 103 or 129 I get this message:
Error: Program is too large, cannot fit all subroutines into available program memory
Here is the code:
'Snow melt V 3.0 08-23-11'Tried to remobe PWM for Snow Sensor'Copyright E.V. LaBudde 2011'Tested all modes 08-09-11 'Chip model#chip 16F88, 8 'Pic model and clock MHz#config INTRC_IO 'Use internal OscillatorOsctune=b'111110''works from 111000 to 000011'Set the pin directionsdirportA.0In'Cold pin 17dirportA.1In'Hot pin 18dirportA.2In'Ambient Temp pin 1dirportA.3Out'Heater pin 2dirportA.4Out'Pump pin 3dirportB.0In'New Snow signal pin 6 Tied to pin 8dirportB.1In'Manual Heat mode pin 7dirportB.2In'Snow pin 8dirPortB.3Out'Test port Pin 9dirportB.4In'Manual Circulate Mode Pin 10dirportB.5Out'LCD pin 11'set defines#define SendAHigh Set PORTB.5 Off 'Note Polarity for 4X20 Newhaven display#define SendALow Set PORTB.5 On #define Cold An0#define Hot An1#define Temp An2#define Heater PortA.3#define Pump PortA.4#define ManualMode PortB.1#define Snow PortB.2#define Test PortB.3#define ManualCirc PortB.4#define LCD PortB.5 dimAmbientTasintegerdimWaterinTasintegerdimWateroutTasintegerdimAmbientTempasworddimE_timeminasworddimDeltaTasworddimDisplayAmbTasworddimDisplayinTasworddimDisplayoutTasworddimWaterinTempasworddimWateroutTempasworddimMeltTime_sasworddimMeltTime_masworddimMeltTime_Lasword'Set inital parametersInitSer1,r2400,1,8,1,none,invert'LCD interface Positive going Standby bit 2400 baudSetLCD=On'Init LCDwait200msOption_reg.7=off'Enable WPUMeltTime_s=0'Zero Melt timesMeltTime_m=0MeltTime_L=0E_timesec=0'Zero Elapsed timesE_timemin=0E_timehrs=0Tons=0OnInterruptExtInt0CallSnowCheckStandby:SetPump=Off'Turn system OffSetHeater=On'Keep heater on to defrostE_timesec=0'Zero Elapsed timesE_timemin=0Ambient=ReadAD(Temp)'Read Ambient air sensorReadTableTconvert,Ambient,AmbientTemp'Look up temeperature valueAmbientT=AmbientTemp-80'Correct for lack of negiative numbers in tablecallReadWater'Check Water TempcallStandbyDisplay'Refresh display Count=0'Zero Write counter for EEprom writerIfManualMode=OffandManualCirc=OnthenGotoManual'Goto manual modeIfManualCirc=OffandManualMode=OnthenGotoCirc'Goto circulate modeIfManualMode=OnandManualCirc=Onthennop'Prevent going to neverlandIfManualMode=OffandManualCirc=Offthennop'Prevent going to neverlandIfAmbientT>-25thenGotoStandby'Bypass fluid measurementSetHeater=OffSetPump=On'Circulate water to measure WaterinTwait30sSetPump=OffSetHeater=OncallReadWater`'Read water temperatureIfAmbientT<-25andWaterinT<-15thenGotoWarm'Keep unit off for as long as possibleWait1h'Do hourlyGotoStandby'SubsManual:'Turn on system Checked 10-19-11CallTurnOnsSetPump=OnSetHeater=OnPWMOff'Turn on heater on snow sensorIfSnow=OnthenMeltTime_s+=1'record melt timeMeltTime_m=MeltTime_s/60EPWrite255,MeltTime_m'Record melt timecallElapsed_time'Measure on timecallReadWater'Read water temperaturecallManualDisplay'Refresh displaycallWrite'Measure DeltaT in 10 min intervals and write to EEpromIfManualMode=OnthenGotoStandbyWait673msGotoManualCirc:'Checked 10-19-11SetPump=OnSetHeater=OffcallElapsed_time'Measure on timecallReadWater'Read water temperaturecallCircDisplay'Refresh displayIfManualCirc=OnthenGotoStandbyWait713msGotoCircHeat:'Checked 10-19-11CallTurnOnsSetPump=On'Turn on systemSetHeater=OnPWMOff'Turn on heater on snow sensorIfSnow=OnthenMeltTime_s+=1'record melt timeMeltTime_m=MeltTime_s/60EPWrite255,MeltTime_m'Record melt timecallElapsed_time'Measure on timecallReadWater'Read water temperaturecallHeatDisplay'Refresh displaycallWrite'Measure DeltaT in 10 min intervals and write to EEprom IfSnow=Offthen'Clear snow and wait 30 min.Wait30mgotoStandbyEndIfWait685msGotoHeatWarm:'Checked 10-19-11PulseOutTest,1msSetPump=On'Turn on systemSetHeater=OncallReadWater'Read water temperaturecallWarmDisplay'Refresh displayifWaterinT>100thengotoStandby'Warm up water then turn offWait703msGotoWarmSubSnowCheckwait1500msIfSnow=Onthengotoheat'Test for sensor failIfSnow=OffThencallFailDisplayReturnSubManualDisplaycallClearserprint1,"Mode:"serprint1,"Man"serprint1," T"MeltTime_m=MeltTime_s/60Serprint1,MeltTime_mSerprint1,"m"callCommonDisplayReturnSubCircDisplaycallClearserprint1,"Mode:"serprint1,"Circ"callCommonDisplayReturnSubStandbyDisplaycallClearserprint1,"Mode:"serprint1,"Sby"EPRead255,MeltTime_LSerprint1," MTime:"'Read melt timeSerprint1,MeltTime_LcallCommonDisplayWait1sReturnSubWarmDisplaycallClearcallFirstserprint1,"Mode:"serprint1,"Warm"callCommonDisplayReturnSubHeatDisplaycallClearcallFirstserprint1,"Mode:"serprint1,"Heat"callCommonDisplayReturnFailDisplay:callClearcallFirstserprint1,"Mode:"serprint1,"SENSOR FAILURE"callCommonDisplayGotoFailDisplaySubCommonDisplaycallsecondcallElapsed_time'Measure on timeserprint1,"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 sReturnSubReadWaterWaterin=ReadAD(cold)ReadTableTconvert,Waterin,WaterinTempWaterinT=WaterinTemp-80Waterout=ReadAD(hot)ReadTableTconvert,Waterout,WateroutTempWateroutT=WateroutTemp-80ReturnSubElapsed_timeE_timesec+=1'SecondsIfE_timesec=60thenE_timesec=0E_timemin+=1'MinutesendifReturnSubWriteDeltaT=WateroutT-WaterinTEPWrite0,DeltaT'Store first Delta T measurementIfE_timemin%10=0then'Measure DeltaT in 10 min intervals and write to EEprom Count+=1EPWriteCount,DeltaTEndIfReturnSubTurnOnsTurnOn+=1EPWrite254,TurnOnReturnSubTestDisplayCallClearserprint1,"First line"CallsecondSerprint1,"Second line"CallThirdSerprint1,"Third line"CallfourthSerprint1,"Fourth line"wait1sReturn'NewHaven Display utilitiesSubClearsersend1,254'start CMDsersend1,81'clear screenReturnSubFirstsersend1,254'start CMDsersend1,69'First linesersend1,0ReturnSubSecondsersend1,254'start CMDsersend1,69'second linesersend1,64ReturnSubThirdsersend1,254'start CMDsersend1,69'Third linesersend1,20ReturnSubFourthsersend1,254'start CMDsersend1,69'Fourth linesersend1,84ReturnSubBaud'1=300, 2=1200, 3=2400, 4=9600, 5=14.4k. 6=19.2k, 7=57.6k, 8=115.2ksersend1,254'start CMDsersend1,97'baud selectsersend1,4'9600-wait100usReturn/code]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am getting a strange error message associated with the PWMoff command. If I try to comment out line 103 or 129 I get this message:
Error: Program is too large, cannot fit all subroutines into available program memory
Here is the code: