michaelb
Joined: 28 Nov 2005 Posts: 17
|
Character String - Out of RAM |
Posted: Mon Nov 28, 2005 11:46 am |
|
|
Hi,
I'm trying to store 82 characters in a string, from an RS232 input. When defining my string I get up to a length of 77 chars with 54% RAM usage, but when I try 78 chars I'm told 'Not enough RAM for all variables'. Any ideas? The code below is work in progress and isn't intended to do anyhting yet, I just want to buffer this data first.
Code: |
#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7)
#endif
#include <lcd.c>
#define esc 0x1B
void cls();
char letter[1];
char string[78];
#int_RDA
RDA_isr()
{
letter[0] = getc();
putc(letter[0]);
lcd_putc(letter[0]);
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();
delay_ms(6);
cls();
lcd_putc("OK - 3");
printf("Ready\n\r");
delay_ms(1000);
cls();
printf("Listening\n\r");
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
while(TRUE)
{
}
}
void cls(void)
{
printf("%c[2J",esc);
}
|
i want to be able to add letter[0] to a free element in string[82] ideally. I'd appreciate any help with this.
Thanks,
Michael |
|