Linker bug 0:240 W-0 Array has been split over two banks: _

General discussion on mikroPascal.
Post Reply
Author
Message
xotet
Posts: 16
Joined: 26 Oct 2005 14:37

Linker bug 0:240 W-0 Array has been split over two banks: _

#1 Post by xotet » 29 May 2007 15:26

Testing a simple code i have a problem with the converisons library:

This code works ok:

Code: Select all

   {Copyright Notice

This library for the SHT temperature and humidity sensors is based on the

application datasheet Sample Code humidity sensor SHTxx from Sensirion.

MikroPascal program for SHTxx sensor By Medrea Florin Andrei.
}

program SHT75_P16;

uses sensirion_lib_p16;

var NoError : boolean;
    temperature, humidity,setpoint : real;
    lcd_txt : string[20];
    str:string[7];
    temp: real; Absolute 0x60;
    raw_array:array [0..3] of byte; absolute 0x60;
    count: byte;
    str_raw: string[17];
    
procedure init;
 Begin
  delay_ms(1000);
  setpoint:= 60.0;
  TRISA:=0;
  Porta:=0;
  CMCON := 7;
  ADCON1 := 15;
  Glcd_Init(PORTB, 2, 3, 4, 5, 7, 6, PORTD);  //EasyPIC3
  Glcd_Fill(0xAA);
  Glcd_Set_Font(@FontSystem5x8, 5, 8, 32);
  Glcd_Fill(0x00);
  For count:= 0 to 3 do raw_array[count]:= Eeprom_read(count); //load min value from Eeprom
 end;
 
 
begin
  init;
  sensirion_init(PORTC,0,1); //sensirion_init(port,data,clock);
  while true do
    begin
      NoError := sensirion_get_temp_hum(temperature, humidity);
      if NoError then
       begin
        If setpoint<humidity then Porta.0:=1 //Activate relay
        else
        Porta.0:=0;
        lcd_txt := 'Temperature         ';
        Glcd_Write_Text(lcd_txt, 0, 0, 1);
        FloatToStr(temperature, lcd_txt);
        str:='';
        Strncat(str,lcd_txt,5);
        str:= str+'C';
        Glcd_Write_Text(str, 0, 1, 1);
        lcd_txt := 'Humidity            ';
        Glcd_Write_Text(lcd_txt, 0, 2, 1);
        FloatToStr(humidity, lcd_txt);
        str:='';
        Strncat(str,lcd_txt,5);
        str:=str + '%';
        Glcd_Write_Text(str, 0, 3, 1);
      if  temperature<temp then  //check for min Value
        begin
          temp:=temperature;
          For count:= 0 to 3 Do Eeprom_write(count,raw_array[count]); //save value to Eeprom
          FloatToStr(temp,str_raw);
          str:='';
          Strncat(str,str_raw,5);
          Glcd_write_text(str,0,6,1);
        end;
         For count:= 0 to 3 do raw_array[count]:= Eeprom_read(count); //load min Value
         FloattoStr(temp,str_raw);
         str:='';
         Strncat(str,str_raw,5);
         Glcd_write_text(str,0,6,1);
        end
      else
        begin
          Glcd_Fill(0x00);
          lcd_txt := 'ERROR READING SHTxx ';
          Glcd_Write_Text(lcd_txt, 0, 4, 1);
        end;
        delay_ms(10000);
    end;
end.

This code that do the same don´t work the linker splits and the pics freezes:

Code: Select all


{Copyright Notice

This library for the SHT temperature and humidity sensors is based on the

application datasheet Sample Code humidity sensor SHTxx from Sensirion.

MikroPascal program for SHTxx sensor By Medrea Florin Andrei.
}

program SHT75_P16;

uses sensirion_lib_p16;

var NoError : boolean;
    temperature, humidity,setpoint : real;
    lcd_txt : string[20];
    str:string[7];
    temp: real; Absolute 0x60;
    raw_array:array [0..3] of byte; absolute 0x60;
    count: byte;
    str_raw: string[17];
    
procedure init;
 Begin
  delay_ms(1000);
  setpoint:= 60.0;
  TRISA:=0;
  Porta:=0;
  CMCON := 7;
  ADCON1 := 15;
  Glcd_Init(PORTB, 2, 3, 4, 5, 7, 6, PORTD);  //EasyPIC3
  Glcd_Fill(0xAA);
  Glcd_Set_Font(@FontSystem5x8, 5, 8, 32);
  Glcd_Fill(0x00);
  For count:= 0 to 3 do raw_array[count]:= Eeprom_read(count); //load min value from Eeprom
 end;
 
procedure display_values;
 begin
  lcd_txt := 'Temperature         ';
  Glcd_Write_Text(lcd_txt, 0, 0, 1);
  FloatToStr(temperature, lcd_txt);
  str:='';
  Strncat(str,lcd_txt,5);
  str:= str+'C';
  Glcd_Write_Text(str, 0, 1, 1);
  lcd_txt := 'Humidity            ';
  Glcd_Write_Text(lcd_txt, 0, 2, 1);
  FloatToStr(humidity, lcd_txt);
  str:='';
  Strncat(str,lcd_txt,5);
  str:=str + '%';
  Glcd_Write_Text(str, 0, 3, 1);
end;
 
 
begin
  init;
  sensirion_init(PORTC,0,1); //sensirion_init(port,data,clock);
  while true do
    begin
      NoError := sensirion_get_temp_hum(temperature, humidity);
      if NoError then
       begin
        If setpoint<humidity then Porta.0:=1 //Activate relay
        else
        Porta.0:=0;
       display_values;
      if  temperature<temp then  //check for min Value
        begin
          temp:=temperature;
          For count:= 0 to 3 Do Eeprom_write(count,raw_array[count]); //save value to Eeprom
          FloatToStr(temp,str_raw);
          str:='';
          Strncat(str,str_raw,5);
          Glcd_write_text(str,0,6,1);
        end;
         For count:= 0 to 3 do raw_array[count]:= Eeprom_read(count); //load min Value
         FloattoStr(temp,str_raw);
         str:='';
         Strncat(str,str_raw,5);
         Glcd_write_text(str,0,6,1);
        end
      else
        begin
          Glcd_Fill(0x00);
          lcd_txt := 'ERROR READING SHTxx ';
          Glcd_Write_Text(lcd_txt, 0, 4, 1);
        end;
        delay_ms(10000);
    end;
end.

 Does anybody know how to solve this?

uwe1722
Posts: 128
Joined: 24 Sep 2005 08:47
Location: Germany

#2 Post by uwe1722 » 29 May 2007 16:59

hello xotet,

what PIC do you use?

xotet
Posts: 16
Joined: 26 Oct 2005 14:37

#3 Post by xotet » 29 May 2007 21:01

I use 16f877A

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 30 May 2007 07:52

Some of the arrays could not fit in one memory bank. Since P16 have gaps in RAM space, there is a great danger that access to an array will be wrong.

What you have to do is to open the statistics window, to open the datasheet for 16F877A and to check which arrays got split over two banks. Then, you should make changes by using the "absolute" keyword in order to move the offensive array into one bank.

Probably the best solution would be that you use P18 chip, such as P18F452 which is pin to pin compatible with P16F877A. P18 family has no gaps in RAM memory and array handling is much faster.

tgmcn
Posts: 26
Joined: 30 Nov 2007 23:14
Location: Redlands, California

Is there a P18 PIC which is pin-compatible to a 16F690?

#5 Post by tgmcn » 10 Jan 2009 12:06

zristic wrote:Some of the arrays could not fit in one memory bank. Since P16 have gaps in RAM space, there is a great danger that access to an array will be wrong.

Probably the best solution would be that you use P18 chip, such as P18F452 which is pin to pin compatible with P16F877A. P18 family has no gaps in RAM memory and array handling is much faster.
Is there a P18 family PIC which is pin-compatible to a 16F690?

arcom
Posts: 271
Joined: 07 Dec 2007 17:00
Location: Rijeka/Croatia
Contact:

#6 Post by arcom » 10 Jan 2009 12:27

16F690 is a 20-pin device so any P18 PIC in 20-pin package is pin-to-pin compatible with it. Unfortunately, there are only 2 P18 PICs that are available in 20-pin PDIP package - 18F13K50 and 18F14K50 and they have a USB peripheral on-board so RA2 is not available on those PICs.

Centurion35
Posts: 11
Joined: 09 Jun 2009 10:57

Re: Linker bug 0:240 W-0 Array has been split over two banks

#7 Post by Centurion35 » 11 Jun 2009 11:58

I want to ask you do you have the e-mail of Barbarossa from the forum in http://www.mikroe.com
Because I read that he has written the source code for pic16f690 and sht75.If you can help me with the source code for pic16f690,sht75,LCD(2x16) and schematic sheet I will be very gratefull.The problem that I have is that I can't show nothing on the LCD. I send you proteus file and the code . Please if you can help me write back to me. Maybe I have mistake with the registers that I have to set while I start a project in Micro c Compiler. Or maybe I don't make correct frequency of the internal and external oscilator. Or maybe I don't use correctly libraries in Micro C- Please check this for me.
Thank you in advance.

User avatar
igor.stancic
mikroElektronika team
Posts: 71
Joined: 21 Apr 2009 09:56
Location: Belgrade, Serbia

#8 Post by igor.stancic » 12 Jun 2009 09:13

Centurion35, you are spamming the forum with multiple messages of the same
kind. Please do not do that again.

Thanks.

Igor

Post Reply

Return to “mikroPascal General”