GLCD Commands

Help
2013-05-14
2013-05-30
  • I found the GLCD.h file in the GCB include files and tried to use it.
    Below is what I started with but I keep getting errors i.e.   "lcd.h (259): Error: SYSLCDTEMP.0 is not a valid I/O pin or port"
    Has anybody worked with this command before?

    ;Chip Settings
    #chip 16F886,16
    '#config MCLRE = on 'enable reset switch on CHIPINO
    #include <chipino.h>
    ;Defines (Constants)
    #define GLCD_RW PORTB.1 'D9
    #define GLCD_RESET PORTB.5 'D13
    #define GLCD_CS1 PORTB.3 'D11
    #define GLCD_CS2 PORTB.4 'D12
    #define GLCD_RS PORTB.0 'D8
    #define GLCD_ENABLE PORTB.2 'D10
    #define GLCD_DB0 PORTC.7 'D0
    #define GLCD_DB1 PORTC.6 'D1
    #define GLCD_DB2 PORTC.5 'D2
    #define GLCD_DB3 PORTC.4 'D3
    #define GLCD_DB4 PORTC.3 'D4
    #define GLCD_DB5 PORTC.2 'D5
    #define GLCD_DB6 PORTC.1 'D6
    #define GLCD_DB7 PORTC.0 'D7

    'Dir Portb.2 in
    InitGLCD
    Start:
    CLS
    GLCDPrint 0,0,"Hello"
    Wait 1 s
    Goto Start

     
  • joe rocci
    joe rocci
    2013-05-15

    I don't recognize the CHIPINO.h include, but I did try it with GLCD.h and got the error you reported. It compiles fine (with GLCD.h) if you comment out the CLS instruction, so I'd look in the LCD.h and GLCD.h code to find references to CLS. If you comment out those code sections and compile, you might be able to track down the problem.

     
  • Thanks. That helped.
    It's GLCDCLS not CLS on the graphic LCD.
    I also found the CS1, CS2 defines are backwards.
    I had to actually connect the CS1 pin to the CS2 defined pin and then CS2 to the CS1 defined pin.
    Otherwise the display is shifted to the left.
    Here is the code corrected.
    chipino.h defines the pin connections on the Arduino style CHIPINO module.

    ;Chip Settings
    #chip 16F886,16
    '#config MCLRE = on           'enable reset switch on CHIPINO
    #include <chipino.h>
    #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 10,10, "hello"               'Print hello
    for char = 48 to 57                  'Print 0 through 9
    GLCDdrawCHAR 20,20, char
    wait 1 s
    next
    line 0,32,127,32
    for xvar = 0 to 80                               'draw line across bottom of screen
    pset xvar,63,on
    next
    Wait 10 s
    Goto Start

     
  • joe rocci
    joe rocci
    2013-05-17

    I'm glad you got it going. I'm not familiar with the chipino.h include file. Is it part of some new version of GCB, or did you write it or is it from a third party? Can you send it to me for future reference?

    Joe
    >>>joeATroccisDOTcom<<<

     
  • CHIPINO is a Microchip PIC based module designed around the Arduino style footprint.
    chipino.h is just a file of defines that rename the pins to make it easier write and understand.
    The way I wrote the GLCD example doesn't actually use the defines so chipino.h could be left out.
    The chipino.h contents are shown below.
    You can get more info on the chipino at CHIPINO.com

    'CHIPINO I/O Header File

    #define D0 portc.7
    #define D1 portc.6
    #define D2 portc.5
    #define D3 portc.4
    #define D4 portc.3
    #define D5 portc.2
    #define D6 portc.1
    #define D7 portc.0
    #define D8 portb.0
    #define D9 portb.1
    #define D10 portb.2
    #define D11 portb.3
    #define D12 portb.4
    #define D13 portb.5

    #define A0 porta.0
    #define A1 porta.1
    #define A2 porta.2
    #define A3 porta.3
    #define A4 porta.5
    #define A5 porta.4