Menu

Errors when compiling st7920 example code.

Help
2018-05-05
2018-05-05
  • Geoff Wrightson

    Geoff Wrightson - 2018-05-05

    Hi Get multiple errors when trying to compile test source for st7920 glcd
    Also not sure if this is normal but unable to open glcd.h with a text editor.
    thanks in advance For any help.
    Geoff

    These are the errors

    st790ex.gcb (25): Error: Syntax Error
    st790ex.gcb (30): Error: Syntax Error
    st790ex.gcb (40): Error: Syntax Error
    st790ex.gcb (53): Error: Syntax Error
    st790ex.gcb (56): Error: Syntax Error
    /opt/GCBASIC/include//glcd_ST7920.h (227): Error: 6 is not a variable


    This is the code


    ;Chip Settings
    #chip 16F1937,32
    #config Osc = INT, VCAPEN_OFF, MCLRE_ON, PLLEN_ON, CLKOUTEN_OFF

    #include <glcd.h>
    
    #define GLCD_TYPE GLCD_TYPE_ST7920
    #define GLCD_IO 8
    #define GLCD_WIDTH 128
    #define GLCD_HEIGHT 160
    #define GLCDFontWidth 6
    
    ' read delay of 25 is required at 32mhz, this can be reduced to 0 for slower clock speeds
    #define ST7920ReadDelay 25
    ' write delay of 2 is required at 32mhz.  this can be reduced to 1 for slower clock speeds
    #define ST7920WriteDelay 2
    
    #define GLCD_RS PORTa.0
    #define GLCD_Enable PORTA.1
    #define GLCD_RW PORTA.2
    #define GLCD_RESET PORTA.3
    #define GLCD_DATA_PORT PORTD
    
    ST7920GLCDEnableGraphics
    ST7920GLCDClearGraphics
    GLCDPrint 0, 1, "Great Cow BASIC "
    wait 1 s
    
    GLCDCLS
    ST7920GLCDClearGraphics
    
    rrun = 0
    dim msg1 as string * 16
    
    dim  xradius, yordinate , radiusErr, incrementalxradius, orginalxradius, orginalyordinate as Integer
    
    
    Do forever
        GLCDCLS
        ST7920GLCDClearGraphics          ;clear screen
        GLCDDrawString 30,0,"ChipMhz@"    ;print string
        GLCDDrawString 78,0, str(ChipMhz) ;print string
        Circle(10,10,10,0)            ;upper left
        Circle(117,10,10,0)           ;upper right
        Circle(63,31,10,0)            ;center
        Circle(63,31,20,0)            ;center
        Circle(10,53,10,0)            ;lower left
        Circle(117,53,10,0)           ;lower right
        GLCDDrawString 30,54,"PIC16F1937" ;print string
        wait 1 s                  ;wait
        FilledBox( 0,0,128,63)          ;create box
        for ypos = 0 to 63              ;draw row by row
             ST7920lineh 0,ypos,128, 0      ;draw line
        next
        wait 1 s                  ;wait
        ST7920GLCDClearGraphics          ;clear
    loop
    


     
  • Anobium

    Anobium - 2018-05-05

    The Help needs updating and you have defined a constant for a varialble - probably because the Help is incorrect. And, a few of the specific device functions were renamaned.

    You code is shown below but you you should look at C:\GCB@Syn\GreatCowBasic\Demos\GLCD Solutions\GLCD Simple Demonstration Solutions\GLCD_Simple_Demonstation_16F1789_for_ST7920@32.gcb in your demos - this should be a better start.

    Evan

    ;Chip Settings
        #chip 16F1937,32
        #config Osc = INT, VCAPEN_OFF, MCLRE_ON, PLLEN_ON, CLKOUTEN_OFF
    
        #include <glcd.h>
    
        #define GLCD_TYPE GLCD_TYPE_ST7920
        #define GLCD_IO 8
    
        ' read delay of 25 is required at 32mhz, this can be reduced to 0 for slower clock speeds
        #define ST7920ReadDelay 25
        ' write delay of 2 is required at 32mhz.  this can be reduced to 1 for slower clock speeds
        #define ST7920WriteDelay 2
    
        #define GLCD_RS PORTa.0
        #define GLCD_Enable PORTA.1
        #define GLCD_RW PORTA.2
        #define GLCD_RESET PORTA.3
        #define GLCD_DATA_PORT PORTD
    
        ST7920GLCDEnableGraphics
        GLCDClearGraphics_ST7920
        GLCDPrint 0, 1, "Great Cow BASIC "
        wait 1 s
    
        GLCDCLS
        GLCDClearGraphics_ST7920
    
        rrun = 0
        dim msg1 as string * 16
    
        dim  xradius, yordinate , radiusErr, incrementalxradius, orginalxradius, orginalyordinate as Integer
    
    
        Do forever
            GLCDCLS
            GLCDClearGraphics_ST7920          ;clear screen
            GLCDDrawString 30,0,"ChipMhz@"    ;print string
            GLCDDrawString 78,0, str(ChipMhz) ;print string
            Circle(10,10,10,0)            ;upper left
            Circle(117,10,10,0)           ;upper right
            Circle(63,31,10,0)            ;center
            Circle(63,31,20,0)            ;center
            Circle(10,53,10,0)            ;lower left
            Circle(117,53,10,0)           ;lower right
            GLCDDrawString 30,54,"PIC16F1937" ;print string
            wait 1 s                  ;wait
            FilledBox( 0,0,128,63)          ;create box
            for ypos = 0 to 63              ;draw row by row
                 line 0,ypos,128, 0      ;draw line
            next
            wait 1 s                  ;wait
            ;clear
        loop
    
     
  • Geoff Wrightson

    Geoff Wrightson - 2018-05-05

    Hi Have worked out the first 5 errors still not sure on sure on the last one.
    Geoff

     
  • Geoff Wrightson

    Geoff Wrightson - 2018-05-05

    Thanks Evan ....

     

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.