DEAR sir,
I made simple code for check the Glcd work with OshonSoft pic simulator IDE.But I found that
the result is not as code .so I try with proteus .result is same .I try with REAL pic simulator and i got same result is ok like code .any person help me to get the result with OshonSoft pic simulator IDE and proteus.
my code is
;Chip Settings
chip 16F877,16
;Include files (Libraries)
include <glcd.h>
;Defines (Constants)
define GLCD_RW PORTC.1 'D9 to pin 5 of LCD
define GLCD_RESET PORTC.5 'D13 to pin 17 of LCD
define GLCD_CS1 PORTC.3 'D12 to actually since CS1, CS2 are backward
define GLCD_CS2 PORTC.4 'D11 to actually since CS1, CS2 are backward
Please have look at the great example shown in the online help. See http://gcbasic.sourceforge.net/help/glcdoverview.htm You have to remove the chipino.h reference but I just compiled successfully and then I tested in a simulation. All looks great.
This functionality does seem work ok.
Let us know if you have any further questions.
Last edit: Anobium 2014-03-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear sir ,
Thanks for early replay.I get the example code of Glcd from sourceforge.net.
I remove chipino.h.and compiled with latset version of GCB.Cde is compiled successfully into HEX file .So i start proteus and put the hex file into pic16f886.
Run the simulation .i only got some dots on KS0108 GLCD display .I try with pic simulator IDE .I get the same result .Plz can you tell me which one simulator software you use.And you can add an bulit in simulator in GCGB for quick debugging
the code.
Thanks for appreciate
My changed code here
;Chip Settings
chip 16F886,16
include <glcd.h>
;Defines (Constants)
define GLCD_RW PORTB.1 'D9 to pin 5 of LCD
define GLCD_RESET PORTB.5 'D13 to pin 17 of LCD
define GLCD_CS1 PORTB.3 'D12 to actually since CS1, CS2 are backward
define GLCD_CS2 PORTB.4 'D11 to actually since CS1, CS2 are backward
define GLCD_RS PORTB.0 'D8 to pin 4 D/I pin on LCD
define GLCD_ENABLE PORTB.2 'D10 to Pin 6 on LCD
define GLCD_DB0 PORTC.7 'D0 to pin 7 on LCD
define GLCD_DB1 PORTC.6 'D1 to pin 8 on LCD
define GLCD_DB2 PORTC.5 'D2 to pin 9 on LCD
define GLCD_DB3 PORTC.4 'D3 to pin 10 on LCD
define GLCD_DB4 PORTC.3 'D4 to pin 11 on LCD
define GLCD_DB5 PORTC.2 'D5 to pin 12 on LCD
define GLCD_DB6 PORTC.1 'D6 to pin 13 on LCD
define GLCD_DB7 PORTC.0 'D7 to pin 14 on LCD
InitGLCD
Start:
GLCDCLS
GLCDPrint 0,10,"Hello" 'Print Hello
wait 5 s
GLCDPrint 0,10, "ASCII #:" 'Print ASCII #:
Box 18,30,28,40 'Draw Box Around ASCII Character
for char = 15 to 129 'Print 0 through 9
GLCDPrint 17, 20 , Str(char)
GLCDdrawCHAR 20,30, char
wait 1 s
next
line 0,50,127,50 'Draw Line using line command
for xvar = 0 to 80 'draw line using Pset command
pset xvar,63,on '
next '
Wait 10 s
Goto Start
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear sir,
Yes i try to swap CS1 and CS2 .The result is same .just change the position of Character.but Character is not clear only some dot flash as before.i have pic simulator IDE v6.98 and proteus v7.5.plz you check with both and i am sure you get my
point quickly.
THANKS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Sir,
Don,t be go puzzle yourself .If you read my first post .I already mention that the code is work with Real pic simulator.but the same code is not work with another simulator like OshonSoft pic simulator IDE and proteus v7.5.
I am sure you understand my point
THANKS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Munble Mumle
I can confirm the issue, I tried to run the code from the help file (with the AVRMega168) of GCB using Proteus V8.1 and I just get garbage, and two notices
in the compilation. See the attached file
No one has tried it with a real GLCD? I can only at the end of next week :-(
good night, Marco
I need someone else to test on a real device. I do not have a standard GLCD - I have a ST7920 GLCD device on test on at the moment. Over to someone else.
Some background information that may help. Some of this is not in the Help File but I will add this week.
GCBasic is intended to support the following three types of GLCD/chip set. Please check the type of chipset you have configured.
GLCD_TYPE_KS0108 - The 'norm' for GLCDs. 8 bit Parallel connection.
GLCD_TYPE_ST7735 - An optional configuration. Serial connection.
GLCD_TYPE_ST7920 - An optional configuration. 4 bit Parallel connection (with LATx support). Under test @ April 2014. This device supports Chinese fonts. This code is NOT in the public domain, yet.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As to the original post the question seems to be why the GLCD example does not simulate on OshonSoft and Proteus. I do not use sim software so can't add to that conversation.
If the OP's code is taken literally, the PortX to GLCD data line assignments are reversed from what they should be. If this pin assignment is used, then the compiled hex does not work! Use the data pin assignments like in the Help file with DB0 -> PortX.0, DB1 -> PortX.1 etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well.... after working with Marco on an unrelated issue.... we have an issue with the GLCD driver (again!).
When using the OshonSoft GCB fails to operate as expected. I have looked at the KS0108 datasheet and we have a timing issue on READ BYTE operations. As I do not have a KS0108 this is based on the datasheet and the OshonSoft sim not working.
So, the question is.... do I correct GLCD.H to work as per the specification? Or, not? If, not then the OshonSoft sim will not work as expected.
The changes involves moving the read operation between the ENABLE_ON and the ENABLE_OFF. Currently, the read operation happens after the ENABLE_OFF!!. A simple change.
Advice please.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Meanwhile for those with this issue, please do the following. This will call a revised function whilst we figure out how to handle this change.
Add an extra define as follows
#define GLCDReadByte OshonSoftGLCDReadByte
Then, add this function at the end of your code
function OshonSoftGLCDReadByte
'Set data pin directions
Dir GLCD_DB7 In
Dir GLCD_DB6 In
Dir GLCD_DB5 In
Dir GLCD_DB4 In
Dir GLCD_DB3 In
Dir GLCD_DB2 In
Dir GLCD_DB1 In
Dir GLCD_DB0 In
'Set LCD data direction
Set GLCD_RW On
'Read
Set GLCD_ENABLE On
Wait 2 us
'Get input data
' corrected 7/05/2013
GLCDReadByte.7 = GLCD_DB7
GLCDReadByte.6 = GLCD_DB6
GLCDReadByte.5 = GLCD_DB5
GLCDReadByte.4 = GLCD_DB4
GLCDReadByte.3 = GLCD_DB3
GLCDReadByte.2 = GLCD_DB2
GLCDReadByte.1 = GLCD_DB1
GLCDReadByte.0 = GLCD_DB0
Set GLCD_ENABLE Off
Wait 2 us
End Function
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Evan,
I did not use a GLCDReadByte when I initially developed my KS0108 driver, but just used a static delay with a handful of nop's. Pulled from my GLCD_Read code at the time, I interpreted the datasheet in a similar way:
DEAR sir,
I made simple code for check the Glcd work with OshonSoft pic simulator IDE.But I found that
the result is not as code .so I try with proteus .result is same .I try with REAL pic simulator and i got same result is ok like code .any person help me to get the result with OshonSoft pic simulator IDE and proteus.
my code is
;Chip Settings
chip 16F877,16
;Include files (Libraries)
include <glcd.h>
;Defines (Constants)
define GLCD_RW PORTC.1 'D9 to pin 5 of LCD
define GLCD_RESET PORTC.5 'D13 to pin 17 of LCD
define GLCD_CS1 PORTC.3 'D12 to actually since CS1, CS2 are backward
define GLCD_CS2 PORTC.4 'D11 to actually since CS1, CS2 are backward
define GLCD_RS PORTC.7
define GLCD_ENABLE PORTC.2 'D10 to Pin 6 on LCD
define GLCD_DB0 PORTB.0 'D0 to pin 7 on LCD
define GLCD_DB1 PORTB.1 'D1 to pin 8 on LCD
define GLCD_DB2 PORTB.2 'D2 to pin 9 on LCD
define GLCD_DB3 PORTB.3 'D3 to pin 10 on LCD
define GLCD_DB4 PORTB.4 'D4 to pin 11 on LCD
define GLCD_DB5 PORTB.5 'D5 to pin 12 on LCD
define GLCD_DB6 PORTB.6 'D6 to pin 13 on LCD
define GLCD_DB7 PORTB.7 'D7 to pin 14 on LCD
Start:
Do Forever
InitGLCD
GLCDCLS
GLCDPrint 1, 2, "MURTAZA"
Wait 1000 ms
GLCDCLS
GLCDPrint 10, 10, "GOOD"
Wait 1000 ms
GLCDCLS
GLCDPrint 16 , 20 , "GREAT"
Wait 1000 ms
GLCDCLS
GLCDPrint 20 , 30 , "COW"
GLCDPrint 25 , 40 , "BASIC"
Wait 1000 ms
Loop
Goto Start
Welcome to the forum.
Please have look at the great example shown in the online help. See http://gcbasic.sourceforge.net/help/glcdoverview.htm You have to remove the chipino.h reference but I just compiled successfully and then I tested in a simulation. All looks great.
This functionality does seem work ok.
Let us know if you have any further questions.
Last edit: Anobium 2014-03-29
Dear sir ,
Thanks for early replay.I get the example code of Glcd from sourceforge.net.
I remove chipino.h.and compiled with latset version of GCB.Cde is compiled successfully into HEX file .So i start proteus and put the hex file into pic16f886.
Run the simulation .i only got some dots on KS0108 GLCD display .I try with pic simulator IDE .I get the same result .Plz can you tell me which one simulator software you use.And you can add an bulit in simulator in GCGB for quick debugging
the code.
Thanks for appreciate
My changed code here
;Chip Settings
chip 16F886,16
include <glcd.h>
;Defines (Constants)
define GLCD_RW PORTB.1 'D9 to pin 5 of LCD
define GLCD_RESET PORTB.5 'D13 to pin 17 of LCD
define GLCD_CS1 PORTB.3 'D12 to actually since CS1, CS2 are backward
define GLCD_CS2 PORTB.4 'D11 to actually since CS1, CS2 are backward
define GLCD_RS PORTB.0 'D8 to pin 4 D/I pin on LCD
define GLCD_ENABLE PORTB.2 'D10 to Pin 6 on LCD
define GLCD_DB0 PORTC.7 'D0 to pin 7 on LCD
define GLCD_DB1 PORTC.6 'D1 to pin 8 on LCD
define GLCD_DB2 PORTC.5 'D2 to pin 9 on LCD
define GLCD_DB3 PORTC.4 'D3 to pin 10 on LCD
define GLCD_DB4 PORTC.3 'D4 to pin 11 on LCD
define GLCD_DB5 PORTC.2 'D5 to pin 12 on LCD
define GLCD_DB6 PORTC.1 'D6 to pin 13 on LCD
define GLCD_DB7 PORTC.0 'D7 to pin 14 on LCD
InitGLCD
Start:
GLCDCLS
GLCDPrint 0,10,"Hello" 'Print Hello
wait 5 s
GLCDPrint 0,10, "ASCII #:" 'Print ASCII #:
Box 18,30,28,40 'Draw Box Around ASCII Character
for char = 15 to 129 'Print 0 through 9
GLCDPrint 17, 20 , Str(char)
GLCDdrawCHAR 20,30, char
wait 1 s
next
line 0,50,127,50 'Draw Line using line command
for xvar = 0 to 80 'draw line using Pset command
pset xvar,63,on '
next '
Wait 10 s
Goto Start
Can you try swapping the ports on GLCD_CS1 and GLCD_CS2? Let us know the results.
I tested using the Pic Simulator.
Dear sir,
Yes i try to swap CS1 and CS2 .The result is same .just change the position of Character.but Character is not clear only some dot flash as before.i have pic simulator IDE v6.98 and proteus v7.5.plz you check with both and i am sure you get my
point quickly.
THANKS
I am puzzled.
Can you describe your development process? Mine is as follows for your use case.
What is your process? Keep it high level please.
Dear Sir,
Don,t be go puzzle yourself .If you read my first post .I already mention that the code is work with Real pic simulator.but the same code is not work with another simulator like OshonSoft pic simulator IDE and proteus v7.5.
I am sure you understand my point
THANKS
Munble Mumle
I can confirm the issue, I tried to run the code from the help file (with the AVRMega168) of GCB using Proteus V8.1 and I just get garbage, and two notices
in the compilation. See the attached file
No one has tried it with a real GLCD? I can only at the end of next week :-(
good night, Marco
Last edit: Marcoos 2014-04-04
I need someone else to test on a real device. I do not have a standard GLCD - I have a ST7920 GLCD device on test on at the moment. Over to someone else.
Some background information that may help. Some of this is not in the Help File but I will add this week.
GCBasic is intended to support the following three types of GLCD/chip set. Please check the type of chipset you have configured.
As to the original post the question seems to be why the GLCD example does not simulate on OshonSoft and Proteus. I do not use sim software so can't add to that conversation.
The Help file example works fine on hardware GLCD (I'm using a 16f1783), except I had to swap CS1 and CS2. See here for that conversation: https://sourceforge.net/p/gcbasic/discussion/579126/thread/b4738c3a/#97eb
Further on in that post I've proposed a software fix for swapping CS1/CS2.
If the OP's code is taken literally, the PortX to GLCD data line assignments are reversed from what they should be. If this pin assignment is used, then the compiled hex does not work! Use the data pin assignments like in the Help file with DB0 -> PortX.0, DB1 -> PortX.1 etc.
Well.... after working with Marco on an unrelated issue.... we have an issue with the GLCD driver (again!).
When using the OshonSoft GCB fails to operate as expected. I have looked at the KS0108 datasheet and we have a timing issue on READ BYTE operations. As I do not have a KS0108 this is based on the datasheet and the OshonSoft sim not working.
So, the question is.... do I correct GLCD.H to work as per the specification? Or, not? If, not then the OshonSoft sim will not work as expected.
The changes involves moving the read operation between the ENABLE_ON and the ENABLE_OFF. Currently, the read operation happens after the ENABLE_OFF!!. A simple change.
Advice please.
Meanwhile for those with this issue, please do the following. This will call a revised function whilst we figure out how to handle this change.
Add an extra define as follows
Then, add this function at the end of your code
Evan,
I did not use a GLCDReadByte when I initially developed my KS0108 driver, but just used a static delay with a handful of nop's. Pulled from my GLCD_Read code at the time, I interpreted the datasheet in a similar way: