How do I size my arrays with Boost C 7.04 version?

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Tue Apr 09, 2013 10:33 pm

Hello everybody:

It is possible to make arrays with Boot C 7.04 for PIC, but I don't know what does this sentence exactly "The only constrains is that an array must fit into a single RAM bank" mean??

In PIC guide I had found this for Data Memory (RAM memory) "Each bank extendes up to 7Fh, 128 bytes"

Does this mean that a array's size couldn't exceed the 128 bytes?? But Does the array's size be smaller than 128 bytes??

Thanks in advanced

Regards
Carmen Garcia

User avatar
Benj
Matrix Staff
Posts: 14151
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4080 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Benj » Wed Apr 10, 2013 10:47 am

Hello,

8-bit PICs have a restricted RAM page size of 256 bytes so this is your limitation. Arrays smaller then or equal to 256 bytes should work fine.

There is a way to allow larger arrays using the idx2 parameter as described here.
viewtopic.php?f=29&t=11262&p=42493&hilit=large+arrays#p39852
These users thanked the author Benj for the post:
Carmen Garcia (Thu Apr 11, 2013 7:03 pm)
Rating: 5.56%
 

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Wed Apr 10, 2013 12:36 pm

Hi Benj:

But in my PIC's guide appears "Each bank extendes up to 7Fh, 128 bytes"...

Please, another question:
I created this C code in a C FlowCode v5 Macro:

MX_UINT8 Array[20][17];
Array[1][1]=0xff;

FCV_Valor= Array[1][1]=0xff;


And the "Valor" variable doesn't set to 0xff.


Thanks you very much Benj.

Regards
Carmen Garcia

User avatar
Benj
Matrix Staff
Posts: 14151
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4080 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Benj » Wed Apr 10, 2013 5:08 pm

Hello,

Flash banks are 128 bytes, RAM banks are 256 bytes.

What about this instead.

Code: Select all

MX_UINT8 Array[5][5];
Array[1][1]=0xff;
FCV_VALOR = Array[1][1];


20 x 17 = 340 bytes which is over then 256 page limit!

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Thu Apr 11, 2013 7:36 am

:? I need to sleep....

Thanks you very much¡

Regards
Carmen Garcia

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Thu Apr 11, 2013 6:40 pm

Hello Benj:

I have set right the array's size for the appropiate use of RAM:

MX_UINT8 n=10;
MX_UINT8 Id=17;
MX_UINT8 Neighbor_Table[n][Id];

Neighbor_Table[1][1]=0xff;

FCV_VALOR = Neighbor_Table[1][1];


I suspect the type of variables doesn't match because I am using the portions of C Code I seen in the Main Code (putting in C View...)

I don't found a explicit guide for to create C code in C FlowCode Macro¡¡

Thanks you very much

Regards
Last edited by Carmen Garcia on Thu Apr 11, 2013 7:07 pm, edited 1 time in total.
Carmen Garcia

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Thu Apr 11, 2013 6:42 pm

I know what happens...The C Code doesn't simulate in FlowCode.

Really does not exist a way for simulate the C code?

I was lookin for a Boost C simulator in the FlowCode Program Drectory (...\Flowcode\Tools\boostc\) but I didn't see anything.
Now I download a simulator from the official site, SourceBoost.

Any incovenience? Other alternatives?

Thanks¡

Regards
Carmen Garcia

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby dazz » Thu Apr 11, 2013 8:36 pm

HI Carmen
I think Martin uses a program called pic simulator do a search on this forum as martin has linked to it quite a few times, i think you compile to hex then load the hex into the sim and away you go

Regards
Dazz
These users thanked the author dazz for the post:
medelec35 (Thu Apr 11, 2013 11:36 pm)
Rating: 5.56%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby dazz » Thu Apr 11, 2013 8:51 pm

hi Carmen
Heres a link to the sim mentioned above post by enamul viewtopic.php?f=7&t=11092&p=38159&hilit=pic+simulator+martin#p38159
Regards
Dazz
These users thanked the author dazz for the post (total 3):
medelec35 (Thu Apr 11, 2013 11:36 pm) • Carmen Garcia (Wed Apr 17, 2013 11:01 am) • ardu (Sun May 19, 2013 2:33 pm)
Rating: 16.67%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Carmen Garcia
Posts: 59
Joined: Thu Aug 23, 2012 10:37 am
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: How do I size my arrays with Boost C 7.04 version?

Postby Carmen Garcia » Wed Apr 17, 2013 11:01 am

Thanks very much Dazz, but I not got much time and this simulator requires very much for learn...Finally I have opted for NO 2 dimensions arrays.

Thanks very much everybody.

Regards.
Carmen Garcia