CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RAM problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
leto



Joined: 02 Aug 2005
Posts: 14

View user's profile Send private message

RAM problem
PostPosted: Mon Aug 08, 2005 2:45 pm     Reply with quote

Hi,

My program has a "not enough RAM for all variables". But just when I put a comment "//" in char k definition (1st of main) instead of when I get out this comment. I guest when i put a comment im releasing memory but it has an opposite behavior.
Could anyone help me.

Thanks

Code:

void main() {
//   char k;

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);

   SET_TRIS_A( 0x00 );           // All A are outputs
   SET_TRIS_B( 0xFF );           // B7,B6,B5,B4,B4,B2,B1 are inputs


   rtc_init();                   
   set_clock();         
   init_ext_eeprom();


   port_b=0;
   seconds=0;
   minutes=0;

   setup_counters(RTCC_INTERNAL, RTCC_DIV_256 );
   set_rtcc(236);     
   ext_int_edge(L_TO_H);   
   enable_interrupts(INT_RB); 
   enable_interrupts(global);
   port_b_pullups(FALSE);   
   glcd_init(ON);
   while (TRUE);
}


Page ROM  %  RAM  Functions:
---- --- --- ---  ----------
0      19   0   1  @delay_ms1
1    121   2   1  glcd_init
1    150   3   9  glcd_pixel
1    106   2   4  glcd_fillScreen
1      39   1   2  @MUL88
0      50   1   2  glcd_writeByte
1      60   1   2  glcd_readByte
0    235   4   0  @const71
0    235   4   0  @const74
0      42   1   0  @const77
0    262   5   0  @const80
0    227   4   0  @const83
1      23   0   5  @MUL1616
1    219   4  20  glcd_text57
1    404   7  58  glcd_myText
0      18   0   1  @I2C_WRITEU_1_59_60_20000000
1      17   0   1  @I2C_READU_1_59_60_20000000
0      13   0   0  init_ext_eeprom
1      49   1   5  read_ext_eeprom
0      14   0   0  @const10575
0      23   0   3  @DIV88
1    129   2   6  @PRINTF_D_9600_62_63
0      94   2   0  @const220
0      28   1   0  @const223
0      42   1   0  @const226
1      10   0   1  @SPRINTF
1    117   2   6  @PRINTF_D_458
1      94   2   8  @PRINTF_LU_458
2   1148  21   4  MainMenu
0      26   0   0  @const10818
0      25   0   0  @const10822
1      63   1   4  Menu2
1    104   2   4  MenuSelect
0        6   0   0  @const10873
0      29   1   0  @const10899
0      26   0   0  @const10907
1      35   1   8  i2c_eeprom_ReadString
0      30   1   2  write_ds1302_byte
0      19   0   2  write_ds1302
0      90   2   2  rtc_init
0      23   0   3  bin_to_bcd
0    101   2   7  set_clock
0      14   0   0  crono
0      46   1   0  tecla
0    127   2   4  external
0      13   0   0  @const11069
0      22   0   0  TiempoSector
2    481   9  22  welcome
0      23   0   0  @const11102
0      20   0   0  @const11106
0      14   0   0  @const11111
0      11   0   0  @const11126
0      13   0   0  @const11134
1    110   2   1  main
1      42   1   0  KeyPress
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 09, 2005 12:48 pm     Reply with quote

I think no one has answered your post because we think it's
probably the same answer that's been posted 1000 times already.

But anyway, here's the likely answer:
The compiler doesn't normally use all the RAM banks with the PCM
compiler. You have to tell it to use RAM at addresses above 0xFF.
This is done by adding the #device *=16 statement, as shown below.
It should be placed in the next line after your main #include statement.
Example:
Code:
#include <16F877.h>
#device *=16
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group