ROM FULL

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

ROM FULL

Postby JLeith » Mon Nov 26, 2012 9:26 pm

Hello,
I must be under a Black Cloud....

I was trying to see if I can take my code for the Scoreboard and try to load it into the PIC16F1826 and I have reach the cliff edge with another mile stone.

ROM Size Error - I'm not sure how to address this size issue - Do I need to delete code or do I find a new chip ?
Rom Error.jpg
Rom Error.jpg (21.27 KiB) Viewed 1712 times

i hope I can find a fix because I believe I have to add a few lines of Code outside of Flowcode and this might cause me problems.

Can anyone help explain my fix to this issue ?

John

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: ROM FULL

Postby Enamul » Mon Nov 26, 2012 11:11 pm

Hi John
You have overfilled the PIC memory and it has two solutions one is to use same pin-configuration PIC with large memory (easy but money consuming solution); the other is to customize the code to fit in the memory but that will be bit tough as 24% extra bit you have to modify or removed. So you can now choose which one you like to do..
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: ROM FULL

Postby JLeith » Tue Nov 27, 2012 6:44 am

Thank you, Enamul

I was afraid that might be the case. Enamul can you recommend a new DIP18 chip it might be easier seeing I have the PCB being made for the PIC16F1826 ?

I will have a look at the program and see hat I can do.

Is there a way to see how much memory is in use ?

What else can go wrong with my project.

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

Re: ROM FULL

Postby medelec35 » Wed Nov 28, 2012 12:33 am

Hi John,
If you go to:
http://www.microchip.com/maps/Microcontroller.aspx

You can select 18pins min and maximum:
more mem1.png
more mem1.png (3.41 KiB) Viewed 1683 times


Then following microcontrollers will be displayed:
more mem2.png
more mem2.png (47.02 KiB) Viewed 1683 times


As you can see the order shown is in order of memory size.
The only way of know how much memory code uses is do what you have already done..
Compile to hex.
Then rom usage is displayed as you have highlighted.
Just remember to divide value of rom shown by 1024 to convert to kbytes.
Taking your Flowchart and an example: ROM used = 2539.
= 2539/1024= 2.48K
According to datasheet for your device ROM =2K
Therefore you will require a ROM size of 4K minimum (Kwords).

There are ways of reducing code. E.g use local variables. Place frequently used calculations within a macro and so each time calculation is required, just use call macro function.
use a Temp variable for several comparisons.
instead of oldVar1= NewVar1
NewVar1 = input
If oldVar1 <> NewVar1 then variable has changed.

oldVar2= NewVar2
NewVar2 = input
If oldVar2 <> NewVar2 then variable has changed.

Use:
Temp= NewVar1
NewVar1 = input
If Temp <> NewVar1 then variable has changed.

Temp= NewVar2
NewVar2 = input
If Temp <> NewVar2 then variable has changed

Etc.

Use as small variable as you can get away with.
E.g. if variable is always going to be between 0 and 100, don't use INT use bytes instead.

Martin
These users thanked the author medelec35 for the post:
JLeith (Wed Nov 28, 2012 12:43 am)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: ROM FULL

Postby JLeith » Wed Nov 28, 2012 1:00 am

Hello Martin,

This information is like finding the pot of gold at the end of the rainbow.
Pot of Gold.jpg
Pot of Gold.jpg (1.96 KiB) Viewed 1678 times

I was on the Digkey site trying to find a chip I did not try Microchip. I will follow your information and see if I need a new chip.

I have been trying to strip down and redesign my project and see if I can get it to fit.

So I suspect this coming week between setting up for Xmas I will be trying to clean up my code.

I see the heavy part is sending out the display. I was reading over the OLD design and they used a Table for On state and a Table for off state but in "C' it use the IF then and I think it takes a little more RAM.

Martin seeing I have switches and Led in the Project Panel does that add into the RAM calculation for HEX ?

Thank you,
John