I used the GLCD Demo that I modified by removing most of the things that were to be displayed but left one.
I added to turn one two LEDs and turn on the backlight.
All I get is a blank screen except the LEDs light up and the backlight comes on.
I suspect CS1 and CS2, they are active low but it looks like KS0108.h has them as active high but I am not sure that I am correct but if I am how do I correct them.
You ave apparently identified my problem, the defines for the ports are not correct.
However I have 4 PCB with the GLCD connected the way I have them in my program so I need to re-identify them. I thought I saw somewhere I could do that. Re define the ports in my program after the #include <glcd.h> Or maybe change the GLCD.h to what I need then then include it like #include "GLCD.h" in my project folder so it would not get changed when GCBasic got updated.</glcd.h>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My original post had my configurations that is where I started. I have them that way on 3 other compilers, I know things are easy to miss so I will check them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have checked my GLCD port connections against my PCB drawings and actual PCB and they match. I am stumped, can't find what is wrong. If you decouple your ports an try it might tell us something. I sure appreciate you helping me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I quickly looked. I had to stop. But, I know that data line PortD are not the issue.
There is some thing odd in the ports used to control RS/RW & EN. I did not isolate the issue but are those ports controlled by anything in the config?
And, do have a compiler that this PCB/GLCD works with? If yes, post the ASM generated by the compiler; if C based then post the project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a rather large program with many folders so I will attach here the main.c and .asm files.
I would attach the whole program folder but it won't let me attach folders.
This program is what I want to replace with GCBasic
This program is MICROC PRO For PIC COMPILER that is no longer supported.
You changed the chip to 16F877a, I can't use it not enough memory, that is why I selected the PIC18F47K42. I was using PIC18F46K22 but I used all of it's memory.
Here are the first 30 lines of assembly:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=18F47K42, r=DEC
TITLE "C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb"
SUBTITLE "12-22-2024 13:16:42"
;Program compiled by GCBASIC (2024.12.15 (Windows 64 bit) : Build 1447) for Microchip MPASM/MPLAB-X Assembler using FreeBASIC 1.07.1/2024-12-15 CRC248
;Need help?
; Please donate to help support the operational costs of the project. Donate via https://gcbasic.com/donate/
;
; See the GCBASIC forums at http://sourceforge.net/projects/gcbasic/forums,
; Check the documentation and Help at http://gcbasic.sourceforge.net/help/,
;or, email us:
; evanvennn at users dot sourceforge dot net
;***********
; Installation Dir : C:\GCstudio\gcbasic
; Source file : C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb
; Setting file : C:\GCstudio\gcbasic\use.ini
; Preserve mode : 0
; Assembler : GCASM
; Programmer :
; Output file : C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.asm
; Float Capability : 0
;***********
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=18F47K42, r=DEC
TITLE "C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb"
SUBTITLE "12-22-2024 13:16:42"
I added the delays but no change.
I am attaching a PDF of the GLCD I am using.
I will get info on PCB, it is one that I make I can send you my schematic if that will help.
I am in Florida USA.
I am using the PCB set up I used for PIC18F47K42, other components on the board that may be the problem I don't know why they might interfere they are not active but I will remove them like DS1307, DS18B20.
How do I attach more than one file, when I try it removes the first one.
I have the SLG12864G1
I have moved to my prototype set up so I could remove those components and have attached a picture. Ran the program but no change.
I used the GLCD Demo that I modified by removing most of the things that were to be displayed but left one.
I added to turn one two LEDs and turn on the backlight.
All I get is a blank screen except the LEDs light up and the backlight comes on.
I suspect CS1 and CS2, they are active low but it looks like KS0108.h has them as active high but I am not sure that I am correct but if I am how do I correct them.
I have attached my GLCD_Demo.gcb file.
Any help i appreciated.
Your program, attached, with different ports here, however, you cannot pulse the data lines/LEDs like you did. That will mess up the GLCD signals.
And, you have PortE.0 as the Backlight and GLCD_RS - that will not work.
As you can see from the photo - all looks good here.
I just posted a completed and tested K42 demo to GitHub. https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/GLCD_Solutions/GLCD_Simple_Demonstration_Solutions/GLCD_Simple_Demonstation_18F47K42_for_KS0108.gcb
And, the photo: https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/GLCD_Solutions/GLCD_Simple_Demonstration_Solutions/GLCD_Simple_Demonstation_18F47K42_for_KS0108.jpg
Last edit: Anobium 2024-12-22
You ave apparently identified my problem, the defines for the ports are not correct.
However I have 4 PCB with the GLCD connected the way I have them in my program so I need to re-identify them. I thought I saw somewhere I could do that. Re define the ports in my program after the #include <glcd.h> Or maybe change the GLCD.h to what I need then then include it like #include "GLCD.h" in my project folder so it would not get changed when GCBasic got updated.</glcd.h>
Change the GLCD constants to your configuration. There is no need to change GLCD.h
If the CS1 were inverted you would still get a display just swapped around.
Remove the errors and try again.
My original post had my configurations that is where I started. I have them that way on 3 other compilers, I know things are easy to miss so I will check them.
I think they should work. I can decouple and use you ports but yours should work.
I have checked my GLCD port connections against my PCB drawings and actual PCB and they match. I am stumped, can't find what is wrong. If you decouple your ports an try it might tell us something. I sure appreciate you helping me.
I can look Monday morning, London time. I will decouple and test.
I can look Monday morning, London time. I will decouple and test.
Okay thanks, I will continue to try to find my problem.
I quickly looked. I had to stop. But, I know that data line PortD are not the issue.
There is some thing odd in the ports used to control RS/RW & EN. I did not isolate the issue but are those ports controlled by anything in the config?
And, do have a compiler that this PCB/GLCD works with? If yes, post the ASM generated by the compiler; if C based then post the project.
This is a rather large program with many folders so I will attach here the main.c and .asm files.
I would attach the whole program folder but it won't let me attach folders.
This program is what I want to replace with GCBasic
This program is MICROC PRO For PIC COMPILER that is no longer supported.
Since I could not post two files at the same time, maybe I just don't know how to, here is the main.c file
Sorry hit the wrong button, attached is the main c file called SPEEDOMETER_PIC18F47K42.c
Using your config works here. I have attached the program.
Please note I have added in the other control constants. The defaults are show below.
This could be as simple as the constants above - is GCBASIC clocking the GLCD too fast? Trying increasing the reduce.
The C and ASM sources both are missing the key element .. Glcd_Init routines.
I just changed the chip to a 16F877A and load into a SIM. Looks good.
Last edit: Anobium 2024-12-23
Also, please post the top 30 lines of the ASM file being created by GCBASIC compilation process.
I will review to check version etc.
You changed the chip to 16F877a, I can't use it not enough memory, that is why I selected the PIC18F47K42. I was using PIC18F46K22 but I used all of it's memory.
Here are the first 30 lines of assembly:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=18F47K42, r=DEC
TITLE "C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb"
SUBTITLE "12-22-2024 13:16:42"
include <p18f47k42.inc></p18f47k42.inc>
CONFIG CP = OFF, LVP = OFF, WRTSAF = OFF, WRTD = OFF, WRTB = OFF, WDTE = OFF, XINST = OFF, MVECEN = OFF, MCLRE = INTMCLR, FCMEN = ON, CLKOUTEN = OFF, RSTOSC = HFINTOSC_1MHZ, FEXTOSC = OFF
;**************
;Set aside memory locations for variables
; Shared/Access RAM = (SA)
CHARCODE EQU 11 ; 0xB (SA)
CHARCOL EQU 14 ; 0xE (SA)
CHARCOLS EQU 12 ; 0xC (SA)
CHARCOL_H EQU 15 ; 0xF (SA)
CHARLOCX EQU 16 ; 0x10 (SA)
CHARLOCX_H EQU 17 ; 0x11 (SA)
CHARLOCY EQU 18 ; 0x12 (SA)
CHARLOCY_H EQU 19 ; 0x13 (SA)
CHARROW EQU 20 ; 0x14 (SA)
CHARROWS EQU 22 ; 0x16 (SA)
CHARROW_H EQU 21 ; 0x15 (SA)
COL EQU 23 ; 0x17 (SA)
CURRCHARCOL EQU 24 ; 0x18 (SA)
CURRCHARROW EQU 25 ; 0x19 (SA)
CURRCHARVAL EQU 26 ; 0x1A (SA)
CURRCOL EQU 27 ; 0x1B (SA)
CURRPAGE EQU 28 ; 0x1C (SA)
DELAYTEMP EQU 0 ; 0x0 (SA)
DELAYTEMP2 EQU 1 ; 0x1 (SA)
DRAWLINE EQU 29 ; 0x1D (SA)
DRAWLINE_H EQU 30 ; 0x1E (SA)
GLCDBACKGROUND EQU 31 ; 0x1F (SA)
GLCDBACKGROUND_H EQU 32 ; 0x20 (SA)
GLCDBITNO EQU 33 ; 0x21 (SA)
GLCDCHANGE EQU 34 ; 0x22 (SA)
GLCDCOLOUR EQU 35 ; 0x23 (SA)
GLCDCOLOUR_H EQU 36 ; 0x24 (SA)
GLCDDATATEMP EQU 37 ; 0x25 (SA)
GLCDFNTDEFAULT EQU 38 ; 0x26 (SA)
GLCDFNTDEFAULTHEIGHT EQU 39 ; 0x27 (SA)
Changing to the 16F was to test the library and the setup.
Re the top lines. I want the top 30 lines of the ASM file ( not the first 30 lines of ASM).
Wasn't this in the .asm I posted yesterday?
;Program compiled by GCBASIC (2024.12.15 (Windows 64 bit) : Build 1447) for Microchip MPASM/MPLAB-X Assembler using FreeBASIC 1.07.1/2024-12-15 CRC248
;Need help?
; Please donate to help support the operational costs of the project. Donate via https://gcbasic.com/donate/
;
; See the GCBASIC forums at http://sourceforge.net/projects/gcbasic/forums,
; Check the documentation and Help at http://gcbasic.sourceforge.net/help/,
;or, email us:
; evanvennn at users dot sourceforge dot net
;***********
; Installation Dir : C:\GCstudio\gcbasic
; Source file : C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb
; Setting file : C:\GCstudio\gcbasic\use.ini
; Preserve mode : 0
; Assembler : GCASM
; Programmer :
; Output file : C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.asm
; Float Capability : 0
;***********
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=18F47K42, r=DEC
TITLE "C:\Users\pisto\OneDrive\Desktop\GREAT COW PROJECTS\PROJ_1\GLCD12864\GLCD_Demo.gcb"
SUBTITLE "12-22-2024 13:16:42"
include <p18f47k42.inc></p18f47k42.inc>
CONFIG CP = OFF, LVP = OFF, WRTSAF = OFF, WRTD = OFF, WRTB = OFF, WDTE = OFF, XINST = OFF, MVECEN = OFF, MCLRE = INTMCLR, FCMEN = ON, CLKOUTEN = OFF, RSTOSC = HFINTOSC_1MHZ, FEXTOSC = OFF
;**************
;Set aside memory locations for variables
; Shared/Access RAM = (SA)
Thanks, the ASM yesterday was not a GCBASIC compiled ASM but another compiler.
OK. You are on the same build and using GCASM. As these are the latest releases. I have the same here on the machine here.
Have you tried https://sourceforge.net/p/gcbasic/discussion/1073404/thread/74d833c29c/67d1/attachment/GLCD_Demo3.gcb This is the file I tested here. If yes, results?
Did you tried increasing the delays? results ?
Can you photo the GLCD? I have many here and I will look the same model.
Can you photo the PCB and the connection to the GLCD.
I am the main developer of GCBASIC and this is most odd.... puzzled at the moment. I have many solutions using this type of GLCD.
Where are you based?
I added the delays but no change.
I am attaching a PDF of the GLCD I am using.
I will get info on PCB, it is one that I make I can send you my schematic if that will help.
I am in Florida USA.
I am using the PCB set up I used for PIC18F47K42, other components on the board that may be the problem I don't know why they might interfere they are not active but I will remove them like DS1307, DS18B20.
How do I attach more than one file, when I try it removes the first one.
Which model do you have? These are very different model. They look the same.
SLG12864G1: KS0108/AIP31108 Controller, or,
SLG12864G2: ST7920/AIP31020 Controller
I have the SLG12864G1
I have moved to my prototype set up so I could remove those components and have attached a picture. Ran the program but no change.