Hi, Yes, The following code gives "Error: Excessive RAM usage!" Delete some variables, reduce the size of arrays, or upgrade to a more powerful PIC" Upgrade to more powerful PIC not easy for me.
The .ASM seems to use some housekeeping variables up to mem 38. F84a has 68 locations. This is my very first program compiled with GCBasic so I could have screwed up somewhere. Please be so kind and help. Thank you, Cassie
The problem is that I recently increased the default size of string variables. GCBASIC was using 38 bytes to store the smaller variables, then trying to create a 41 byte variable to hold the messages for the Print command.
I've now changed this behaviour, and GCBASIC will now only use 21 bytes on chips with less memory like the 16F84a.
Another minor issue is the ports. You'll need to change these lines:
depending on how you've connected the LCD display to the PIC. The 16F84a doesn't have PORTC or PORTD - only PORTA and PORTB, so these lines will have to be changed for the program to compile. I'd suggest using 4-bit mode for the LCD instead of 8-bit, as less pins are needed on the PIC. To use 4-bit mode, you need to set LCD_IO to 4 and then set these #defines to the correct value:
(You shouldn't connect anything to PORTB.6 or PORTB.7 if you are going to program the PIC while it is connected to the LCD. These pins are used by the PC to download the program to the PIC.)
Hi, Yes, The following code gives "Error: Excessive RAM usage!" Delete some variables, reduce the size of arrays, or upgrade to a more powerful PIC" Upgrade to more powerful PIC not easy for me.
The .ASM seems to use some housekeeping variables up to mem 38. F84a has 68 locations. This is my very first program compiled with GCBasic so I could have screwed up somewhere. Please be so kind and help. Thank you, Cassie
#chip 16F84A, 20
#config HS_OSC, WDT_OFF
'#mem 368
'LCD connection settings
#define LCD_IO 8
#define LCD_DATA_PORT PORTC
#define LCD_RS PORTD.0
#define LCD_RW PORTD.1
#define LCD_Enable PORTD.2
cls
PRINT "Light Meter:"
locate 1,2
PRINT "A GCBASIC Demo"
wait 2 s
do while true
cls
PRINT "Light Level: "
wait 25 10ms
loop
The problem is that I recently increased the default size of string variables. GCBASIC was using 38 bytes to store the smaller variables, then trying to create a 41 byte variable to hold the messages for the Print command.
I've now changed this behaviour, and GCBASIC will now only use 21 bytes on chips with less memory like the 16F84a.
Another minor issue is the ports. You'll need to change these lines:
#define LCD_IO 8
#define LCD_DATA_PORT PORTC
#define LCD_RS PORTD.0
#define LCD_RW PORTD.1
#define LCD_Enable PORTD.2
depending on how you've connected the LCD display to the PIC. The 16F84a doesn't have PORTC or PORTD - only PORTA and PORTB, so these lines will have to be changed for the program to compile. I'd suggest using 4-bit mode for the LCD instead of 8-bit, as less pins are needed on the PIC. To use 4-bit mode, you need to set LCD_IO to 4 and then set these #defines to the correct value:
#define LCD_DB4 PORTB.0
#define LCD_DB5 PORTB.1
#define LCD_DB6 PORTB.2
#define LCD_DB7 PORTB.3
#define LCD_RS PORTB.4
#define LCD_RW PORTB.5
#define LCD_Enable PORTA.0
(You shouldn't connect anything to PORTB.6 or PORTB.7 if you are going to program the PIC while it is connected to the LCD. These pins are used by the PC to download the program to the PIC.)
If you download the latest update, the program will compile fine. The update is available in two files - http://gcbasic.sourceforge.net/newfiles/update.zip or http://gcbasic.sourceforge.net/newfiles/update-nochipdata.zip . The latter does not include the newest (September or October) chip data files, and so will save a little downloading time if you've already got these files.
Thank you for the response and sugestions. The updates was downloaded. Please carry on your good work. Cassie