Memory full ....

I am using PE 6.0.8.0 to write a 08M2LE program, and now getting this msg::

line# 216, col# 12
Error: Memory full - 1 bytes over.

I try to check line# 216, but no such thing, my program ends with line no 213 (the sim-file also). Kind of surprising, but ok, - so I remove one line (high c.0), and check syntax again... and voila:

Compiled successfully.
Memory used = 224 out of 256 bytes.

Having removed and reinstated a few more simple commands, the reported no of memory bytes used, give me more surprises...
 

srnet

Senior Member
My Crystal ball is in for service, and even when it comes back it takes several days to polish it up.

If you want help with a prorgram, perhaps you might post it ?
 

westaust55

Moderator
Do you have a couple of blank lines at the end of your program source file? From recollection the Interpreter always adds an END statement at the end the code as tokenised for download to the actual chip.
This could/would look like there are a few extra lines.

What are the "more surprises"?
 
Last edited:

eggdweather

Senior Member
PICAXE Device
08M2
08M
08
Respective Memory Capacity (bytes) Max. Memory Capacity (lines)
2048 1800
256 220
128 110

Sounds like it's not an 08M2 device selected?
Also, it's no coincidence that 256-32=224, but the significance of the 32 is unknown to me.
 

bpowell

Senior Member
PICAXE Device
08M2
08M
08
Respective Memory Capacity (bytes) Max. Memory Capacity (lines)
2048 1800
256 220
128 110

Sounds like it's not an 08M2 device selected?
Also, it's no coincidence that 256-32=224, but the significance of the 32 is unknown to me.
You forgot one...

08M2LE 256 Bytes, 220 Lines
 

bpowell

Senior Member
Post your code so we can take a look...there is almost always a way to trim it down a few bytes / lines!

Or, you can jump to a 08M2 and have all the space in the world!
 

hippy

Ex-Staff (retired)
Well, the program itself is not the problem at all, I just meant to ask about the weird reports from the compiler....
There may be an explanation for the behaviour you are seeing and looking at the source code may reveal what that is. Otherwise people have to guess what the reason may be.

If there is an issue then having the source code will allow that to be replicated which will make it far easier to analyse and resolve.
 
[
Sounds like it's not an 08M2 device selected?
Also, it's no coincidence that 256-32=224, but the significance of the 32 is unknown to me.[/QUOTE]

Thank you, It did not occur to me that the difference is 32 .. that is a significant number in this game. But surely, the compiler does not report usage of memory in chunks of 32 bytes.. Can Technical please comment on this?
As to posting the program .. I hesitate to do that because it is big, with lots of comments in Norwegian. Without the 'high c.0' command, it runs ok in the simulator .
 
OK, I have tried to strip away lines with comments. The program is for a test box for zeners, based on a 4,5V AA-based battery, and it implements a step-up smps and measurements. Anyway, here is the code:

Code:
;=====================================================================
;******Konstanter ***************************************** 
symbol trykket	= 1		;trykkbryteren er p? input 3 
;PWM-konstanter===========================================
symbol fclock		= 16000	;Klokkefreq i kHz
symbol T1s0			= fclock/4
symbol T0s5			= T1s0/2
symbol T0s2			= T1s0/5
symbol T0s1			= T1s0/10
symbol T0s05		= T1s0/20
;Lager pwm-konstanter med utg.pkt i klokkefrekvensen
symbol fpwm			= 100		;pwm frekv kHz
symbol pwmtemp1		= fclock/fpwm	;kladd		
symbol pwmtemp2		= pwmtemp1/4	;kladd		
symbol pwmperiod		= pwmtemp2-1			
symbol DCinc		= 10		
;Verdier for ulike dutycycle prosenter
symbol DC05		= pwmperiod/5	;5% DC
symbol DC15		= DC05*3		;....
symbol DC25		= pwmperiod
symbol DC50		= pwmperiod*2
symbol DC75		= pwmperiod*3
symbol DC100	= pwmperiod*4
symbol DCstart	= DC05*8	;Startverdi v/testing, litt mindre enn 
					;forventet testverdi. Finnes v/testing
symbol DCmax	= DC75	;DC = 515<->100% med fpwm=60

;For strom/spenningsberegninger
symbol calibvmax	= 262		;Svarer til VB=4,0V, nedre batt grense 
symbol adc10max	= 1023
symbol VBmin100	= 400		;Min brukbar VB
symbol Vcal1064	= 65535	;Intern refsp.x64000 for beregn av VB100
symbol Vcal100	= 102		;Intern refsp.x100 for beregn av V og I
symbol Vcal1000	= 1024	;Intern refsp.x1000 for beregn av V og I
symbol Rmverdi	= 200		;Motstanden som brukes til Iomaling, ohm
symbol Rm4del	= Rmverdi/4	;Forenkler beregninger
symbol Io10settv	= 500		;5 mA i 2kohm dvs 50 mW , gir VRm100=100
;***********[ Variabler ]********************************************* 
symbol Flagg 	= b0		;Flaggene, ingen saa langt 
SYMBOL temp1	= b1		;Gen word variabel
SYMBOL tempwl	= b2		;Low byte av tempw1
SYMBOL tempwh	= b3		;Hi byte av tempw1
SYMBOL tempw	= w1		;Gen word variabel
symbol DC 		= b4 		;Dutycycle for pwm
symbol DCtest	= b5 		;Dutycycle for pwm
symbol teller	= b6
symbol Io10		= b7		;Beregnet DUT-str?m i mA x10

symbol tempw2	= w12
symbol calibval	= w8		;for calibadc, ref = 1,024V 
symbol VB100	= w9		;Ny beregnet batt-spenning i volt x100
symbol Vo100	= w10		;Utspenning ref til 0V x100
					;VB100=400/450 -> VR100=199/202 @25^C
symbol Vz100	= w11		;Beregnet DUT-spenning i volt x100
;......
;******I/O definisjoner **********************************************
SYMBOL Red 		= c.0		;  
symbol gul		= c.1		;
symbol VRmpin	= c.1		;Pin koplet til VR for beregn av Io
SYMBOL Green	= c.2		;  
SYMBOL pwmpin	= c.2		;Output pin for pwm  
symbol tone 	= c.2		;pinnr. for  lydgiveren
symbol Bryter	= pinc.3	;Inp for AV/P?  via wakeup/sleep
SYMBOL Ref100	= c.4		; 
symbol pinc4	= c.4		;pinnr. for potmetret


#picaxe 08M2LE
#terminal 19200


Init:
	setfreq m16
	temp1=pwmperiod
	low pwmpin
	DC = DCstart		;starter litt lavere enn v/test
	pwmout pwmpin,pwmperiod,DC 
	pause T0s5			;Gi 0,5 s til stab....
hoved:
	Vz100=3;For testing ZZZZZZZZZZZZZZ
hovedlp:
	do 
		DC=DC+1
		pwmduty pwmpin,DC
		readadc10 VRmpin,tempw
		'sertxd (#tempw,"-");For testing ZZZZZZZZ
		gosub FinnV100
		sertxd (#tempw,13,10);For testing ZZZZZZZZ
		Io10= tempw/2 	;=VRm100/Rm*100 for mA der Rm=200
	loop until Io10>=Io10settv or DC>DCmax			
	if DC>DCmax then gosub Error;Tester battsp.!
	DCtest=DC			;test-verdi spares
	pwmduty pwmpin,DC25	;For å redusere spenning på utgangen
	'gosub VentPaaTrykk;For testing ZZZZZZZZZZZ
	goto hoved;For testing ZZZZZZZZZZ
	
;Det er klart til testing
	high red		;klarsignal til bruker
;Venter paa at DUT plasseres mot kontaktene
	do
		readadc pinc4,temp1
loop until temp1>5	;(>0)Venter paa DUT
;DUT plassert, vent litt, og videre!
	pause T0s1			;100ms vent
	pwmduty pwmpin,DCtest	;Ca 50mW ut 
;Venter paa at DUT fjernes. Naa maa Vz maales
	do	
		tempw2=tempw
		pause T0s05
		readadc10 pinc4,tempw
	loop until temp1<2	; 
	;DUT fjernet
	gosub VentPaaTrykk
	
	
	goto hoved
	bit3=c.1			;Snu c.1 inn for m?ling av LED sp. VLED
goto hoved

;*********************************************************************
FinnV100: ;Kalles med avlest adc10-verdi i tempw
	'tempw= 3'For testing ZZZZZZZZZZZZ 
	tempw2=1	 
	do	;Finner narmeste 2**N > tempw
		tempw2=tempw2*2
	loop until tempw2>tempw
	tempw2=32768/tempw2*2 max 1024	;Naa er tempw2=1024/k 
	temp1=1024/tempw2 			;og temp1 er naa = k
	calibadc10 calibval			
	calibval=237	'for testing,tilsv. VB= ca 4,4V ZZZZ
	tempw	= tempw2*tempw/calibval*temp1/10
	return ;tempw = V100, dvs maalt spenningx100 (10mV) 

Error:
	low pwmpin
	toggle red
	pause T0s2
	goto Error
	
VentPaaTrykk:;Venter p? at bryter strykkes til den slippes *******
	do 
	loop until bryter=1
	pause T0s05
	do 
	loop until bryter=0
	return


HVIL:		; Hvilemodus for ekstremt lav batteristrom
	pwmout c.2,off
	low c.0,1
	do
		disablebod		; Sl? av str?mforbruk!
		nap 200		; "Sov" i 0,3 sekunder
		enablebod		; Sl? p? str?mforbruket igjen
loop until bryter=1	; Hvis det er blitt trykket, start opp!
	high red			;Vaakn opp!
	goto Init
 

Technical

Technical Support
Staff member
The bytes used count is just an estimate, not fully accurate when a program overflows.

These 2 lines are never processed so just waste space - there are also other instances of unused code:

Code:
[FONT=Verdana]goto hoved[/FONT]    
bit3=c.1            ;Snu c.1 inn for m?ling av LED sp. VLED
goto hoved
You can comment out the sertxd and save a few bytes.
And add the directive #no_end
Or use an 08M2, the LE is now discontinued!
 
Thank you for the answer .. I know parts of the code might look strange , - that is because a lot of experimenting and testing have been going on. And the reason for asking was not to optimize code, but to find out abt the compiler msgs..
And nice to know that the LE has been discontinued, we have used it at my school because of it's lower price.
 
Top