Menu

GLCD example

Help
MBB
2014-03-31
2014-04-03
  • MBB

    MBB - 2014-03-31

    In the help files, under the GLCD section their is a sample program. In it is the following:

    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

    What does the CS1 and CS2 backwards comment mean? Is there an error in Great Cow Basic?

     
  • Chuck Hellebuyck

    I wrote the sample code and they were backward for my display.
    I didn't have another to test so I don't know if the GCB code is backward for CS1 and CS2 or if it was my display.
    Try it and see what you get.

     
  • Anobium

    Anobium - 2014-03-31

    I did try in a simulator and all was good.
    Would you recommend I change? Or, we can wait until others provide feedback.

    Either way I am happy to update.

     
  • MBB

    MBB - 2014-03-31

    I tried it. I also had to run it with CS1 ans CS2 reversed to make it work. This is opposite to what the GLCD data sheet says. I am using a Hantronix HDM64GS12L-4 display

     
  • Chuck Hellebuyck

    Looks like a confirmed bug.
    Anybody else see this?

     
  • Hugh Considine

    Hugh Considine - 2014-04-01

    It's entirely possible this is a bug, my testing was limited to a single LCD with a single PIC. While I do always try to take care with these things, it would have been very easy to get a couple of wires switched on the breadboard and not notice it!

    Do things need to be changed?

     
  • MBB

    MBB - 2014-04-01

    I have only used one PIC and one GLCD so I can't say for sure the problem is with Great Cow or if there is an error in the GLCD data sheet.

     
  • kent_twt4

    kent_twt4 - 2014-04-02

    I wouldn't say it's a bug, because it depends of the display. Take a look at the Arduino Playground link and look at the pinout tables. You would have to say it looks like majority of the displays are reversed from the library. http://playground.arduino.cc/Code/GLCDks0108

    My AZ Display AGM1264F Glcd has to have the CS1 and CS2 leads reversed from the library to run Chuck's sample program. Perhaps a #define to flip them in header if need be? You wouldn't want to burn a PCB and not have the chance to change them later.

     
  • Chuck Hellebuyck

    "My AZ Display AGM1264F Glcd has to have the CS1 and CS2 leads reversed from the library to run Chuck's sample program."

    Actually you verified it is a bug.
    The code as written will not give the proper results as you found.
    The comments are so poorly written I am embarrassed to say I wrote them.
    The comments are trying to state that the CS1 and CS2 should be swapped(RB4 is pin D12 on CHIPINO and RB3 is pin D11 but the comments imply that CS1-RB4 should be connected to D11-RB3 to work properly, and D12 to CS2).

    I ran the sample code in the GLCD included with the Real Pic Simulator and got the wrong results as expected, the display was shifted to the right. When I swapped the connections, the display was correct as hopefully seen in the picture below. The display should be on the left of the screen if running properly. If its on the right then the CS1 and CS2 need to be swapped. I posted a picture below but I'm not sure it will show up as it didn't under preview.
    I also posted pictures at http://www.greatcowbasic.com/sample-projects.html under the GLCD example.

     

    Last edit: Chuck Hellebuyck 2014-04-02
  • Anobium

    Anobium - 2014-04-02

    Can some help me... what needs to be stated into the example in the Help File?

     
  • kent_twt4

    kent_twt4 - 2014-04-03

    I went ahead and incorporated a #define GLCD_SwapCS switch into the existing GLCD.h file if that is O.K. with Hugh? That leaves open the option to just switch the wires like on a breadboard. But if that is inconvenient, then use the #define GLCD_SwapCS option to do that.

    The new header file is commented with "****" where the changes took place in the PSet, and GLCDWriteByte subs. Which can be removed after testing.

    This tested OK with my AGM1264F with the new define, no switching CS1 and CS2 lines. So others can give it a go to confirm.

    HELP FILE:
    Something to the effect in >>> GLCD Overview:Defines:Many GLCD's have the chip select lines CS1 and CS2 lines reversed internally in respect to the header file defines. If output for the GLCD is showing up on the wrong side of the display then this is the case. Wires can be swapped between the CS1 and CS2 wires; Or, done in software by including the following define:

    #define GLCD_SwapCS
    

    Yesterday, I messed up by having the first four control lines reversed :( and wondering why the contrast voltage wasn't working properly. I hope I didn't permanently damage the display, but I may have? If someone could be so kind as to run the following draw line code, and tell me whether or not they see a missing vertical column (One pixel wide) to the right 1/4 of the display, I would appreciate it.

    Test main:

    InitGLCD
    Start:
    GLCDCLS
    line 0,1,127,1                'Draw Line using line command
    line 0,2,127,2
    line 0,3,127,3
    line 0,4,127,4
    GLCDPrint 0,10,"Hello" 'Print Hello
    wait 5 s
    goto Start
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.