W-0 Array has been split over two banks:

General discussion on mikroBasic.
Post Reply
Author
Message
DaBuddha
Posts: 21
Joined: 19 Feb 2008 15:56

W-0 Array has been split over two banks:

#1 Post by DaBuddha » 17 May 2008 06:03

Ok I'm still a newb - so pardon any ignorance I display

So I'm writing my program I think I'm ready to compile and load it to test out the core functionality and it works beautifully (thanks primarily to the search feature of the forums and all of the great info you guys put up here) - so I add more functionality to it and compile and load it and it doesn't work

Specifically when I send it data over the serial port it hangs (but it didn't before)

I don't get any compiler errors but I get like 50 of the warnings listed in the subject line

EasyPIC5, MB7, PIC16F886 - 646 lines of MB code
0:0 W-101 Used ROM: 7472 (91%) Used RAM: 334 (90%)
0:0 W-102 Free ROM: 719 (9%) Free RAM: 34 (10%)

Any thoughts ???

variable definitions follow per request from yo2lio

The rest of the code really long - I'm gonna do some debug work and see if I can figure out where the problem is - I'll post that when I get there.

Code: Select all

include "BootForAll16"
'********************************************************
'* Declarations (globals):
'********************************************************
'* Symbols Declarations:
'********************************************************
symbol CheckSW0 = TestBit(PORTB, 0)
symbol CheckSW1 = TestBit(PORTB, 1)
symbol CheckSW2 = TestBit(PORTB, 2)
symbol CheckPin4 = TestBit(PORTB, 3)
symbol CheckPin7 = TestBit(PORTB, 4)
symbol CheckIR = TestBit(PORTE, 3)
symbol S0Set = SetBit(PORTA, 7)
symbol S0Clear = ClearBit(PORTA, 7)
symbol S1Set = SetBit(PORTA, 6)
symbol S1Clear = ClearBit(PORTA, 6)
'********************************************************
'* Constant Declarations:
'********************************************************
const Ecount           as byte = $00
const Ereset           as byte = $10
const Esolon           as byte = $20
const Eredon           as byte = $30
const Etrpro           as byte = $40
const Eskipl           as byte = $50
const Eskips           as byte = $60
const St_Off           as byte = 0
const St_Stage         as byte = 1
const St_Y1            as byte = 2
const St_GetReady      as byte = 3
const St_Y2            as byte = 4
const St_OnYourMark    as byte = 5
const St_Y3            as byte = 8
const St_S_GetSet      as byte = 9
const St_P_GetSet      as byte = 15
const St_Green         as byte = 16
const St_GO            as byte = 16
const St_Done          as byte = 17
const St_Winner        as byte = 18
const St_RunnerUp      as byte = 20
const St_Red           as byte = 32
const St_FalseStart    as byte = 33
const St_TimeOut       as byte = 48
const St_AllOn         as byte = 63
'********************************************************
'* Variables Declarations:
'********************************************************
dim Tcount             as word
dim Treset             as word
dim Tsolon             as word
dim Tredon             as word
dim Ttrpro             as boolean
dim Tskipl             as boolean
dim Tskips             as boolean
dim RcvParam           as string[20]
dim BlnStart           as boolean
dim LeftLaneActive     as boolean
dim RightLaneActive    as boolean
dim StateLeft          as byte
dim StateRight         as byte
dim TimeLeft           as word
dim TimeRight          as word
dim TimeElapsed        as word
dim TimeTmpLeftF       as float
dim TimeTmpRightF      as float
dim StateTmpLeft       as string[20]
dim StateTmpRight      as string[20]
Last edited by DaBuddha on 17 May 2008 13:23, edited 1 time in total.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 17 May 2008 09:00

hi,

please show part of code with variables definition from your program
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#3 Post by yo2lio » 17 May 2008 18:31

Ok,

Try this :

Code: Select all

'********************************************************
'* Variables Declarations:
'********************************************************
dim RcvParam           as string[20] absolute 32
dim StateTmpLeft       as string[20] absolute 52
dim StateTmpRight      as string[20] absolute 72
dim Tcount             as word
dim Treset             as word
dim Tsolon             as word
dim Tredon             as word
dim Ttrpro             as boolean
dim Tskipl             as boolean
dim Tskips             as boolean
dim BlnStart           as boolean
dim LeftLaneActive     as boolean
dim RightLaneActive    as boolean
dim StateLeft          as byte
dim StateRight         as byte
dim TimeLeft           as word
dim TimeRight          as word
dim TimeElapsed        as word
dim TimeTmpLeftF       as float
dim TimeTmpRightF      as float
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

PTOPRoJect
Posts: 1
Joined: 17 May 2008 22:41

#4 Post by PTOPRoJect » 17 May 2008 23:16

HI, I'm an newbie too and I'm sorry for my english... :oops:
I've searched in the Forum but I haven't found the "perfect answer " ...

I've got the same problem..

The last row of program I've wrote :evil: , the compiler returned me the "routine too large" and I know this is because the main is over 2K size.
So I've created another sub to resolve and free about 400words, but the W0-is appeared.

In this case the array is a string array (16 chars) and very important for the program so 50% of the code doesn't run!

The system is a EasyPIC4 and the chip a 16F877 (the destination will be an 876)
The ROM is about 75% and the RAM about 55%.
I've got an bidimensional string array (declared constant, display messages etc. ) for about 750 bytes(or words?!) so I think that this space is the main problem but I must use it..

How can I resolve it? Is There a tool to explore this feature?

I've found some similar problems but making new code (or changing some instructions ) the W0 error disappeared but with new code it appear randomly...?!
Is It possibile that the number or the lenght of the subs change the space used in Ram? Or it's a problem about the using of this variables?
Is There a method to avoid it?

Thank you.
Marcello

alsopb
Posts: 217
Joined: 31 Oct 2005 00:56

#5 Post by alsopb » 18 May 2008 15:17

Instead of a two dimensional array would two one dimensional arrays work. That may keep them each in a given bank

Brian

DaBuddha
Posts: 21
Joined: 19 Feb 2008 15:56

#6 Post by DaBuddha » 18 May 2008 21:12

well - yo2lio - thanks for the advice - unfortunately it didn't work

after looking into the code a little more deeply it appears that this happens whenever I call a procedure that requires a variable "byref"

here's an example - most times when I send something to the serial port I want to append a CR & LF to the end of the the text before I send - so I wrote a procedure to handle it

Code: Select all

sub procedure USART_Send_Text(dim byref StrOut as string[20], dim BlnEOL as boolean)
  TmpStr = StrOut
  if (BlnEOL = true) then
     strAppendSuf(TmpStr, Chr(13))
     strAppendSuf(TmpStr, Chr(10))
  end if
  Usart_Write_Text(TmpStr)
end sub
the first place I get this array split warning is when I call this procedure - here's the call

Code: Select all

    USART_Send_Text("L: " + StrTemp + " ", false)  
I get several warnings from the compiler on this line
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Textt1
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Text
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Text 0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Text
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Text
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Textt2
0:496 W-0 Array has been split over two banks: ?ProgramGame_Local_Text
so I think I'm doing something wrong in that call

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#7 Post by yo2lio » 18 May 2008 21:27

Move your array global variables in bank 2

Code: Select all

dim RcvParam           as string[20] absolute 160
dim StateTmpLeft       as string[20] absolute 180
dim StateTmpRight      as string[20] absolute 200 
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

DaBuddha
Posts: 21
Joined: 19 Feb 2008 15:56

#8 Post by DaBuddha » 18 May 2008 22:01

y02lio - thanks for the help - but I've 'fixed' most of the warnings - except for a few - basically what I have done is two things
1) insert an absolute on every variable that gives me a warning

Code: Select all

dim RcvParam           as string[20] absolute 32
dim StateTmpLeft       as string[20] 'absolute
dim StateTmpRight      as string[20] 'absolute
dim OutputText         as string[20] absolute 52
dim WriteVal           as string[5]  absolute 72
dim WriteVar           as string[20] absolute 92
dim StrTemp            as string[20] absolute 112
dim TmpStr             as string[20] absolute 132
dim tmp                as string[20] absolute 152
and
2) place whatever text I want into a variable and then perform the strcat and then pass it to the USART_Send_Text - that fixes all of these warings

EXCEPT now I am getting these warnings on constants (I'm sure I have to do the absolute thing on the string constants like I did on the string variables)

but I also get that warning - like this ...

Code: Select all

0:240 W-0 Array has been split over two banks:  _floattostr_local_pref 
from a procedure call but there's no explicit float to str anywhere near line 240 in my code so I assume it's in the floattostr code - which I can't see

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#9 Post by janni » 19 May 2008 00:08

Take a look at this topic: http://www.mikroe.com/forum/viewtopic.php?t=14915. Same situation happens with mB (vide mikroBasic manual - "PIC16 Only Specifics").

DaBuddha
Posts: 21
Joined: 19 Feb 2008 15:56

#10 Post by DaBuddha » 19 May 2008 01:12

OK well - here's a related question - what's the closest PIC18F equivalent to the PIC16F886

Once I add the rest of my program I max out the PIC - so I figure I have to upgrade to 18F - that'll probably solve this issue with the warnings I have been getting.

Jan Rune
Posts: 416
Joined: 21 Oct 2005 23:04
Location: Oslo, Norway

#11 Post by Jan Rune » 19 May 2008 01:42

DaBuddha wrote:OK well - here's a related question - what's the closest PIC18F equivalent to the PIC16F886

Once I add the rest of my program I max out the PIC - so I figure I have to upgrade to 18F - that'll probably solve this issue with the warnings I have been getting.
http://www.microchip.com/ParamChartSear ... &pageId=74

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#12 Post by janni » 19 May 2008 01:44

DaBuddha wrote:... I figure I have to upgrade to 18F - that'll probably solve this issue with the warnings I have been getting.
That it will certainly do :D .

As for the replacement - maybe 2420 (2520), or 2423 (2523) if you'd like 12-bit A/D. Or 2620 with a lot of memory... There are many to choose from.

Post Reply

Return to “mikroBasic General”