18F4620 Memory full! What to do? Oshonsoft

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
I'm adding program sections from previous working programs into one 'final' program. e,g, Compass, GPS, etc.

At the moment I'm working on adding the 5110 LCD section, but have run out of memory space on the 18F4620 PIC. Once these sections work, there will be calculations etc, so some way to go yet.

What alternatives do I have? There is second PIC on the PCB, is it possible to share memory?

Camerart.
 

Attachments

Papabravo

Joined Feb 24, 2006
21,225
Given what I understand about the PIC architecture, it is not likely. I would research the idea of a drop in pin for pin compatible part with more program memory. Worse comes to worse you find a bigger part an re layout your board. Don't feel bad it happens all the time. We used to call this "feature creep" when the requirements changed but the resources didn't. Our only alternative was to call in "super coder" to crunch bytes until it fit.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Given what I understand about the PIC architecture, it is not likely. I would research the idea of a drop in pin for pin compatible part with more program memory. Worse comes to worse you find a bigger part an re layout your board. Don't feel bad it happens all the time. We used to call this "feature creep" when the requirements changed but the resources didn't. Our only alternative was to call in "super coder" to crunch bytes until it fit.
Hi P and J,
This is what I feared :(

Being at the opposite end of the spectrum to a 'super coder' I'm a bit confined, especially as I only use Oshonsoft BASIC, no ASM.

In the program is a line: Define STRING_MAX_LENGTH = 70 to accommodate a GPS NMEA sentence. [$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A (length varies)

So I can carry on programming, I've temporarily changed to 50, which has given me a bit of space. The NMEA sentence ENDs with LF, which is picked up be the program, I'm wondering if I can use a different END as I only need the RED part of the sentence. Does this sound feasible?
C.
 

jjw

Joined Dec 24, 2013
823
You have used only 24% of program space.
Are you running out of RAM space?
There are lots of string variables, each taking 50 bytes.
Are all of them in use or necessary?
 

jjw

Joined Dec 24, 2013
823
Hi P and J,
This is what I feared :(

Being at the opposite end of the spectrum to a 'super coder' I'm a bit confined, especially as I only use Oshonsoft BASIC, no ASM.

In the program is a line: Define STRING_MAX_LENGTH = 70 to accommodate a GPS NMEA sentence. [$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A (length varies)

So I can carry on programming, I've temporarily changed to 50, which has given me a bit of space. The NMEA sentence ENDs with LF, which is picked up be the program, I'm wondering if I can use a different END as I only need the RED part of the sentence. Does this sound feasible?
C.
You can use "E" as the end character.
 

ericgibbs

Joined Jan 29, 2010
18,849
hi C,
You do not need to store all the GPS message, only the parameters of interest N, E and Altitude.
Have a string buffer long enough to store only those values, use a Comma count to identify their location, recall we did it that way about 5 years ago.:rolleyes:
E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
J, I've never understood memory properly. I got a memory low warning.
Looking closer it shows GPR, SFR and Flash, I presume GPR and SFR = RAM, but I've no idea how to vary a program to use the memories in a better way.

E and J, Using "E" as the end character and also using COMMAs looks like the answer.
I do remember using COMMA separation from 5 years ago, and it is already in this program.
I should be able to figure it out.

Since adding a barometer/altimeter, ALTITUDE is now not needed from the NMEA sentence.

(I've never been called an evangelist before, mighty proud)

Thanks all,
C
 

MrChips

Joined Oct 2, 2009
30,806
You are running low on RAM space.

Look over your code and try and economize on use of variables, particularly strings and data arrays.
Do not ask for string lengths longer than you need.
Reuse strings and arrays where possible.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
You are running low on RAM space.

Look over your code and try an economize on use of variables, particularly strings and data arrays.
Do not ask for string lengths longer than you need.
Reuse strings and arrays where possible.
Hi C,
I wish I was that good.

The only programming skills I have, are very poor. The programs I post eg #1 have been written in sections by members of this and other forums, and jigsawed into larger programs by me, which has been amazing, and has helped me 'program' far above my skill level.

I'm pretty sure the previous posts here, will answer my initial question.
Thanks,
C.
 

Papabravo

Joined Feb 24, 2006
21,225
Hi,
J, I've never understood memory properly. I got a memory low warning.
Looking closer it shows GPR, SFR and Flash, I presume GPR and SFR = RAM, but I've no idea how to vary a program to use the memories in a better way.

E and J, Using "E" as the end character and also using COMMAs looks like the answer.
I do remember using COMMA separation from 5 years ago, and it is already in this program.
I should be able to figure it out.

Since adding a barometer/altimeter, ALTITUDE is now not needed from the NMEA sentence.

(I've never been called an evangelist before, mighty proud)

Thanks all,
C
I wasn't referring to @camerart I was referring to Joey, he is the Linux and assembly language evangelist.
 

djsfantasi

Joined Apr 11, 2010
9,163
Are any of your variables constants? For example, a lookup table, strings used in I/O, or array pointers?

I’m not familiar with Oshonsift BASIC on an 18F4630, but Arduino C let’s you place all of these items in program space. I had a program that used a couple of medium-large lookup tables, which I moved into program space and solved my RAM problem.

Is there a similar language feature that you can use?
 

Papabravo

Joined Feb 24, 2006
21,225
Hey, he asked for solutions. It is one.

Just trying to help...
I know that. I was affirming a hypothesis that you would rather have the TS switch to the true faith (.asm programming) than have him hire you -- assuming he could. It was in no way a pejorative comment. I was already a true believer when I learned FAP in 1962. Higher level languages for systems programming was a nascent trend in that era.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Are any of your variables constants? For example, a lookup table, strings used in I/O, or array pointers?

I’m not familiar with Oshonsift BASIC on an 18F4630, but Arduino C let’s you place all of these items in program space. I had a program that used a couple of medium-large lookup tables, which I moved into program space and solved my RAM problem.

Is there a similar language feature that you can use?
Hi D,
I would never have learnt any programming, if I bought my son a Spektrum in the early 80s, and had to switch off the TV. I just picked it up because I am always aiming towards the TV :) and osmosis kicked in. Oshonsoft has a simulator, that I also couldn't do without. Nothing's perfect, but I mostly enjoy myself, and with help get results. apart from that I rely on others. If they suggest lookup tables etc, I use them.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
I know that. I was affirming a hypothesis that you would rather have the TS switch to the true faith (.asm programming) than have him hire you -- assuming he could. It was in no way a pejorative comment. I was already a true believer when I learned FAP in 1962. Higher level languages for systems programming was a nascent trend in that era.
Hi P,
I wish I could learn ASM, but it's impossible for me. I was actually looking at ASM this morning, to see where something is being stored, but even though I found the answer, I couldn't do anything with it. I just carried on and successfully succeeded in what I was trying to do.
I'm ok at machining and mechanical stuff.
C.
 
Top