Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:59 10 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : "not enough memory"

Author Message
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 10:57pm 09 Jan 2016
Copy link to clipboard 
Print this post


Hello from my first post.

I have MMII(170) and a programme about 1760 bytes. When I add to the programme a little bit and upload using MMEdit and run I get a "not enough memory" error. From Geoff C's website it appears that the 170 should be able to handle ~80K of programme and up to 2,500 lines of code (mine is 76).
I am not using any arrays, have about nine variables only.
I have used Tera Term to List and see the last few lines missing.
Is this likely to be correct, or am I getting something wrong.
Thanks,

greg
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 11:05pm 09 Jan 2016
Copy link to clipboard 
Print this post

Hello and welcome to the forums.

This is a bit odd. I assume you are using a recent version of MMEDIT, and that you have Micromite Syntax selected?

Try this:

1) Save a current version of your code in MMEDIT
2) Open Tera Term, and type XMODEM R at the command prompt and then ENTER.
3) In Tera Term, goto FILE/TRANSFER>/XMODEM>/Send...
4) Select the file you saved in MMEDIT, and click OK.

The file should nip across to the MM, and you should see a progress window.
Does the file transfer over OK that way?
Does it run?

Smoke makes things work. When the smoke gets out, it stops!
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 11:21pm 09 Jan 2016
Copy link to clipboard 
Print this post

Hello Grogster,

Thanks for the suggestion but xmodem gave the same error report "Error: Not enough memory". BTW I have tried a brand new MMII pre-loaded from SC as well - same result.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 11:32pm 09 Jan 2016
Copy link to clipboard 
Print this post

Greg,

What does the command "memory" return?

Also, what version of MMBasic?

Doug.

Edit: By that I mean, at the command prompt on the MM2, enter memory and please post the result.Edited by panky 2016-01-11
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 11:37pm 09 Jan 2016
Copy link to clipboard 
Print this post

Hello Doug,

  Quote  
> xmodem r
Error: Not enough memory
> memory
Flash:
1K ( 1%) Program (52 lines)
59K (99%) Free

RAM:
0K ( 0%) 0 Variables
0K ( 0%) General
53K (100%) Free



MM.VER returns 4.06

greg
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 11:41pm 09 Jan 2016
Copy link to clipboard 
Print this post

Greg


If there isn't anything confidential can you post your program and we can see what is happening.

Peter
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 11:42pm 09 Jan 2016
Copy link to clipboard 
Print this post

Hello Doug,

....that was for the shorter version that uploads and runs OK. Let me try the one that doesn't and I'll get back to you. (the longer version is only a few lines longer...)

greg
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 11:50pm 09 Jan 2016
Copy link to clipboard 
Print this post

Yes, please post code if it is not confidential as matherp says.

I have a feeling you have DIM'ed something in the array or string area of things, which is gobbling up all the available RAM. The code will tell us, if you are willing to post it.
Smoke makes things work. When the smoke gets out, it stops!
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 11:50pm 09 Jan 2016
Copy link to clipboard 
Print this post

Hello Doug,

Here is the code (for SIMCOM 5320 3g modem - fwiw)


OPTION AUTORUN ON
watchdog 5*60*1000 'this 5 mins is for testing only. Use 24hrs for permanent.
const dev_id%=29001
DIM amb_temp!=15.5,vbatt1!=14.8,amb_light%=225,vbatt2!=12.8,b6!=13.9,D$ length 64="1",DD$ length 3="111",DDD%=111,count%=1
server$="aaa.bbb.ccc.ddd"
portREM$="wxyz"
portLOC$="pqrs"
setpin 14, dout
pause 20000
settick 60000,TRANS,1

open "Com1:115200" AS #1
pause 2000

DO
LOOP

SUB TRANS
watchdog 180*1000
print #1, "AT+CIPCLOSE=1"
print "AT+CIPCLOSE=1"
pause 1500 : flushbuf

print #1, "AT+NETCLOSE"
print "AT+NETCLOSE"
pause 1500 : flushbuf
Print #1, "AT+NETOPEN"
print "AT+NETOPEN"
pause 1500 : flushbuf

print #1, "AT+CIPMODE=0"
print "AT+CIPMODE=0"
pause 1500 : flushbuf

print #1, "AT+CIPSENDMODE=0"
print "AT+CIPSENDMODE=0"
pause 1500 : flushbuf

print #1, "AT+CIPOPEN=1," + CHR$(34) + "TCP" + CHR$(34) + "," + CHR$(34) + server$ + CHR$(34) + "," + portREM$ + "," + portLOC$
pause 1000
print "AT+CIPOPEN=1," + CHR$(34) + "TCP" + CHR$(34) + "," + CHR$(34) + server$ + CHR$(34) + "," + portREM$ + "," + portLOC$
pause 1000
If LOC(#1)<>0 then
D$=INPUT$(LOC(#1),#1)

Endif
DD$=RIGHT$(D$,3)
DDD%=VAL(DD$)
print #1, "AT+CIPSEND=1,"
print #1, chr$(13)
pause 200

print #1, STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_light%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3)" ,"STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_temp%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3) ","STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_temp%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3 )","STR$(count%,4) + CHR$(10) + CHR$(26)
print STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_light%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3)" ,"STR$(count%,4)
if DDD%=256 then pin(14)=1
pause 2500
pin(14)=0
IF count%=1440 then count%=1
count%=count%+1
amb_temp!=amb_temp!+0.1
pause 1500 : flushbuf

print #1, "AT+CIPCLOSE=1"
print "AT+CIPCLOSE=1"
pause 1500 : flushbuf
print #1, "AT+NETCLOSE"
print "AT+NETCLOSE"
pause 1500 : flushbuf
pause 1500

END SUB

sub flushbuf
watchdog 50000
do : loop until INPUT$(255, #1) = ""
end sub

Thanks for the help.
greg
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 11:52pm 09 Jan 2016
Copy link to clipboard 
Print this post

sorry Peter, didn't notice the change of poster!
g
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 11:53pm 09 Jan 2016
Copy link to clipboard 
Print this post

Greg,

Looks like you are running 4.7beta36 - if you have a Pickit 3, it might be an idea to come up to the stable 4.7beta37 or even Geoff's new 5.0.

Also, Peter's request for the program may help us assist you if it is not confidential

Doug.



... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 11:57pm 09 Jan 2016
Copy link to clipboard 
Print this post

The problem is lines 53 and 54 which are longer than 255 characters

split them as below:

print #1, STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_light%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3)" ,"STR$(dev_id%,5)";
PRINT #1,"STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_temp%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3) ","STR$(dev_id%,5)","STR$(amb_temp!,2,1);
print ","STR$(vbatt1!,2,1)","STR$(amb_temp%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3 )","STR$(count%,4) + CHR$(10) + CHR$(26)
print STR$(dev_id%,5)","STR$(amb_temp!,2,1)","STR$(vbatt1!,2,1)","STR$(amb_light%,3)","STR$(vbatt2!,2,1)","DD$","STR$(DDD%,3)" ,"STR$(count%,4)
Edited by matherp 2016-01-11
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 12:01am 10 Jan 2016
Copy link to clipboard 
Print this post

Hello Glen?, Doug & Panky,(... it appears I'm more interested in my problem than who is posting help!)

I don't have a means of upgrading the firmware ..yet (slow boat from...).
I would be surprised if a firmware revision would affect the memory useage in that way, but then again I am a newbie!
g
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 12:01am 10 Jan 2016
Copy link to clipboard 
Print this post

[Quote=matherp]The problem is lines 53 and 54 which are longer than 255 characters [/Quote]

Agreed.

Subtle error though, as I note that the console says there is PLENTY of memory available, so this was a bit of a curly one!
Smoke makes things work. When the smoke gets out, it stops!
 
expo
Newbie

Joined: 10/01/2016
Location: Australia
Posts: 25
Posted: 12:28am 10 Jan 2016
Copy link to clipboard 
Print this post

Thanks Peter and Glen and Panky,

...a simple, elegant solution...but only if you have the knowledge!

berst wishes,
greg
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 02:40pm 24 Nov 2017
Copy link to clipboard 
Print this post

I've just had this problem
I'm using an E100 board to run my weather display program

[quote][758] Local integer x0a,y0a,x1a,y1a,x2a,y2a
Error: Not enough memory
> memory
Flash:
57K (57%) Program (1234 lines)
11K (10%) 5 Embedded C Routines
4K ( 4%) Library
28K (29%) Free

RAM:
73K (71%) 120 Variables
25K (23%) General
5K ( 6%) Free
[/quote]

The only thing I did differently was increase the size of the pointer from
dim integer ptr(5)=(-7,0, 7,0, 0,-85) ' define size of the pointers
to
dim integer ptr(5)=(-7,0, 7,0, 0,-95) ' define size of the pointers

relating to
This SUB
[code]sub rotatetriangle(n as integer, col as integer, angle as float, x as integer, y as integer, x0 as integer, y0 as integer, x1 as integer, y1 as integer, x2 as integer, y2 as integer)
local float sine=sin(rad(angle)),cosine=cos(rad(angle))
local integer x0a,y0a,x1a,y1a,x2a,y2a
x0a= x0*cosine - y0 * sine + x
y0a= y0*cosine + x0 * sine + y
x1a= x1*cosine - y1 * sine + x
y1a= y1*cosine + x1 * sine + y
x2a= x2*cosine - y2 * sine + x
y2a= y2*cosine + x2 * sine + y
xx0(n)=x0a
yy0(n)=y0a
xx1(n)=x1a
yy1(n)=y1a
xx2(n)=x2a
yy2(n)=y2a
tcol(n)=col
end sub[/code]

EDIT: I fixed the problem by changing the pointer size
I'm just curious why it happened when it seems I had lots of memory still availableEdited by lew247 2017-11-26
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025