Hi,
I tried to compile (lcdcursor_4wire_test_16f1827) to compare memory usage with using I2C method (lcdcursor_ic2_adapter_test_hardwarei2c_16f1827)but getting following error with 4wire method.
13:34:32 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
WARNINGs / ERRORs reported by Great Cow BASIC (if Syntax Error, doubleclick on the errormessage below) <<<
Error: LCD Parameters not setup correctly - please correct the LCD setupIncorrect parameters in Set, expected: Set variable.bit status
Duration: 5.3 Seconds.
But with example (lcdcursor_4wire_test_16f1938) in folder \Demos\lcd_solutions\four_wire_lcd_solutions, it compiles without any error.
For 0, 4, 8, 404 LCD types you must define the controlling port.pin for the LCD backlight.
'this port.pin is connected to the LCD backlight via a suitable circuit
#define LCD_Backlight porta.4
...
...
...
...
LCDBacklight ( On )
.... more user code...
LCDBacklight ( Off )
If you remove the backlight calls or add the port, as shown in the Help, the error will disappear.
Should I try to improve the error message?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can try this. Revert the GCB code and change the compiler.
Open a new instant of GCSTUDIO, select the Spanner at top right, then select GC BASIC Compiler, open GCBASIC.BAS. At line about 15107, find 'Handle error messages from incorrect LCD setup and remove, the existing IF - ENDIF construct, then, replace with this.
'Handle error messages from incorrect LCD setup If InStr(ucase( SourceFile(F).FileName ), "LCD.H") > 0 Then If instr(InMessage, "SYSLCDTEMP") > 0 or _ instr(UCASE(InMessage), "LCD_ENABLE") > 0 or _ instr(UCASE(InMessage), Ucase(Message("BadParamsSet"))) > 0 or _ ( instr(UCASE(InMessage), Ucase(Message("NotIONOTVALID"))) > 0 and instr(UCASE(InMessage), Ucase("LCD_EB")) ) _ Then print Subroutine(GetSubID(Origin))->Name If Instr(Subroutine(GetSubID(Origin))->Name, "BACKLIGHT") > 0 Then InMessage = Message( "LCD_Not_Setup" ) + "" + Message("LCD_NO_BACKLITECONSTANT") Else InMessage = Message( "LCD_Not_Setup" ) + "Calling" + Subroutine(GetSubID(Origin))->Name + "()." + InMessage '"LCD Parameters not setup correctly - please correct the LCD setup. "+Subroutine(GetSubID(Origin))->NameEnd IfOrigin=""End ifEnd if
Replace message.dat with the attached.
If you now press F4, there is an option Build GCB Compiler. Select this. The IDE will build a new version for you.
Test. If this works then i will publish soon as the master compiler.
Let me know if this works for you in terms of better error reporting.
Insight
This new piece of program traps the errors, checks the error is from a specific .h file, then, tests to clarify the issue to issue an improved error message.
That looks much better. It tells you what to correct.
Looks ok to you?
38.1 seconds.. what? this takes Total time: 1.375 seconds and I am using an external assembler ( to ensure GCBASIC is working correctly .. you do not need to do this ). But, wow, that is slow.
And, why are you using makeHEX.bat? We are not maintaining that and I would expect that would add all this time to the compilation process.
I just tested in SynWrite . 1.5s.
So, yours is very slow.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The test results clearly shows that I2C method is consuming more resources as compare to 4-Wire method.
Using 4-Wire method:
16:23:46 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
Target-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.hex
Compiler Version: 1.01.00 2023-11-15 (Windows 32 bit) : Build 1300 ** Program Memory:784/4096 words (19.14%)RAM: **28/384 bytes (3.91%) OSC: INTOSC, 32Mhz (Internal oscillator) Chip: 16F1827
Duration: 2.1 Seconds.
Using I2C method:
16:24:19 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\I2C_Display\lcdcursor_ic2_adapter_test_hardwarei2c_16f1827.gcb
Target-File = D:\Awais_PIC\I2C_Display\lcdcursor_ic2_adapter_test_hardwarei2c_16f1827.hex
Compiler Version: 1.01.00 2023-11-15 (Windows 32 bit) : Build 1300 Program Memory: 904/4096 words (22.07%)RAM: 36/384 bytes (5.99%) OSC: INTOSC, 32Mhz (Internal oscillator) Chip: 16F1827
Duration: 2.1 Seconds.
I did this test because I am getting out of memory error while developing a project whereas I have still spare pins on the PIC. So, my next move will be to shift on 4-Wire method.
Thanks, Evan for your prompt reply and help.
Regards,
Awais
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks.
It's lot easier in GCBasic and it reminds me when I started programming in BASIC in 1988 with CASIO FX-802P with very limited program memory.
Right now I am missing floating point calculation in GCBasic.
Regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I tried to compile (lcdcursor_4wire_test_16f1827) to compare memory usage with using I2C method (lcdcursor_ic2_adapter_test_hardwarei2c_16f1827)but getting following error with 4wire method.
13:34:32 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
But with example (lcdcursor_4wire_test_16f1938) in folder \Demos\lcd_solutions\four_wire_lcd_solutions, it compiles without any error.
13:56:04 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\GCB09901\GreatCowBasic\Demos\lcd_solutions\four_wire_lcd_solutions\lcdcursor_4wire_test_16f1938.gcb
Target-File = D:\GCB09901\GreatCowBasic\Demos\lcd_solutions\four_wire_lcd_solutions\lcdcursor_4wire_test_16f1938.hex
Compiler Version: 1.01.00 2023-11-23 (Windows 32 bit) : Build 1308 Program Memory: 766/16384 words (4.68%) RAM: 28/1024 bytes (1.46%) OSC: INTOSC, 16Mhz (Internal oscillator) Chip: 16F1938
Duration: 4.8 Seconds.
Thanks and regards,
Awais
Oh dear.
Is the errant GCB part of the demos? Help? Where would I find the original source ?
I will have a look now.
Hi Evan,
When I put remarks as follows, the code compiled without any error.
15:37:23 G+Stool started with parameter 'hex' -> processing D:\GCB09901\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
Target-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.hex
Compiler Version: 0.99.01 2022-01-27 (Windows 32 bit) : Build 1073 Program Memory: 781/4096 words (19.07%) RAM: 15/384 bytes (3.91%) OSC: INTOSC, 32Mhz (Internal oscillator) Chip: 16F1827
Duration: 1.8 Seconds.
Regards,
Awais
See https://gcbasic.sourceforge.io/help/_lcdbacklight.html
For 0, 4, 8, 404 LCD types you must define the controlling port.pin for the LCD backlight.
If you remove the backlight calls or add the port, as shown in the Help, the error will disappear.
Should I try to improve the error message?
You can try this. Revert the GCB code and change the compiler.
Open a new instant of GCSTUDIO, select the
Spanner
at top right, then selectGC BASIC Compiler
, open GCBASIC.BAS. At line about 15107, find'Handle error messages from incorrect LCD setup
and remove, the existing IF - ENDIF construct, then, replace with this.Replace message.dat with the attached.
If you now press F4, there is an option
Build GCB Compiler
. Select this. The IDE will build a new version for you.Test. If this works then i will publish soon as the master compiler.
Let me know if this works for you in terms of better error reporting.
Insight
This new piece of program traps the errors, checks the error is from a specific .h file, then, tests to clarify the issue to issue an improved error message.
Last edit: Anobium 2023-12-27
I followed your instructions and here is the result.
16:13:40 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
Regards,
Awais
That looks much better. It tells you what to correct.
Looks ok to you?
38.1 seconds.. what? this takes Total time: 1.375 seconds and I am using an external assembler ( to ensure GCBASIC is working correctly .. you do not need to do this ). But, wow, that is slow.
And, why are you using makeHEX.bat? We are not maintaining that and I would expect that would add all this time to the compilation process.
I just tested in SynWrite . 1.5s.
So, yours is very slow.
Yeah, it's much better. I am also using SynWrite. See my last post.
Regards,
Awais
Much faster. 1.5s same as mine. :-)
Got it. Thanks.
In my opinion it will be good to improve the error message.
Regards,
Awais
The test results clearly shows that I2C method is consuming more resources as compare to 4-Wire method.
Using 4-Wire method:
16:23:46 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.gcb
Target-File = D:\Awais_PIC\4Wire_Display\lcdcursor_4wire_test_16f1827.hex
Compiler Version: 1.01.00 2023-11-15 (Windows 32 bit) : Build 1300 ** Program Memory: 784/4096 words (19.14%) RAM: **28/384 bytes (3.91%) OSC: INTOSC, 32Mhz (Internal oscillator) Chip: 16F1827
Duration: 2.1 Seconds.
Using I2C method:
16:24:19 G+Stool started with parameter 'hex' -> processing D:\GCstudio\G+Stools\makeHEX.bat
Source-File = D:\Awais_PIC\I2C_Display\lcdcursor_ic2_adapter_test_hardwarei2c_16f1827.gcb
Target-File = D:\Awais_PIC\I2C_Display\lcdcursor_ic2_adapter_test_hardwarei2c_16f1827.hex
Compiler Version: 1.01.00 2023-11-15 (Windows 32 bit) : Build 1300 Program Memory: 904/4096 words (22.07%) RAM: 36/384 bytes (5.99%) OSC: INTOSC, 32Mhz (Internal oscillator) Chip: 16F1827
Duration: 2.1 Seconds.
I did this test because I am getting out of memory error while developing a project whereas I have still spare pins on the PIC. So, my next move will be to shift on 4-Wire method.
Thanks, Evan for your prompt reply and help.
Regards,
Awais
The I2C LCD uses more routines, sendI2C, writeI2C etc. So, your analyse would make sense. More program space and more RAM ( for caches etc).
Very good insights.
Thanks.
It's lot easier in GCBasic and it reminds me when I started programming in BASIC in 1988 with CASIO FX-802P with very limited program memory.
Right now I am missing floating point calculation in GCBasic.
Regards,
One day I will get to look at the floating point code, again.
Use factorisation in the meanwhile - it will always be faster to use factorisation.