Menu

Error during compiling

Theo
2014-10-28
2014-11-26
1 2 > >> (Page 1 of 2)
  • Theo

    Theo - 2014-10-28

    Error during compiling.

    Program is:
    Atmega8; creating a custom Character with the LCDWriteChar command; script from the help file.

    Compiled with the "new" stdbasic.h from oct 2014 I get the following errormessage during compiling:


    makeHEX.bat
    Great Cow BASIC (0.9 11/5/2014)
    Compiling D:\GCB@Syn_Demos\test with LCDWriteChar.gcb ...
    Done
    Assembling program ...
    An error has been found:
    Error: GCASM: Symbol SYSCALCTEMPX has not been defined
    The message has been logged to the file Errors.txt.
    --------------------------------------------------------

    Compiling with the "old" stdbasic.h from febr. 2014 no error messsage,
    but no output on my 2-wire lcd (witch is using the new swap4 function).

    Attached the program, the asm file compiled with the "new" stdbasic.h and
    the asm file compiled with the "old" stdbasic.h

    Kind regards,

    Theo.

     
  • kent_twt4

    kent_twt4 - 2014-10-28

    I don't have the fix for you, but try this workaround and let us know.

    DIM SYSCALCTEMPX AS BYTE
    
     
  • Theo

    Theo - 2014-10-28

    Thanks for your help, kent_twt4.

    After your workaround:
    No error during compiling but no custom character on the screen.

    I've adapted the original program but the program does not reach 'step2'.

      #chip mega8,8
    
      #include <74LS164.h> ; include My IO 74LS164
    
     'Use LCD in 2-wire mode with 74LS164 / 74HC164
      #define LCD_IO 2
      #define LCD_DB PORTC.0            ; databit
      #define LCD_CB PORTC.1            ; clockbit
      #define LCD_NO_RW
    
      'My own IO settings
      #define SWX PORTC.2               ; input pin from pushbuttons (A,B,C,D)
      #define Led PORTC.5               ; output pin for led
      #define SoundOut PORTC.0          ; output pin for tone
      Dir SWX in                        ; set port as input for pushbuttons
    
    DIM SYSCALCTEMPX AS BYTE
    
      BuzzerOn
      tone 440,50                       ; Beep
      tone 660,50
    
    'Create an array to store the character until it is copied
    Dim TempArray(8)
    
    'Set the array to hold the character
    TempArray(1) = b'00011011'
    TempArray(2) = b'00011011'
    TempArray(3) = b'00000000'
    TempArray(4) = b'00000100'
    TempArray(5) = b'00000000'
    TempArray(6) = b'00010001'
    TempArray(7) = b'00010001'
    TempArray(8) = b'00001110'
    
    cls
    
    Locate 0,0
    Print "Step-1"
    wait 1 s
    cls
    
    'Copy the character from the array to the LCD
    LCDCreateChar 0, TempArray()
    
    Locate 0,0
    Print "Step-2"
    wait 1 s
    
    'Draw the custom character
    LCDWriteChar 0
    

    Any help is welcome.

     
  • Anobium

    Anobium - 2014-10-28

    We had the same issue last week.

    Unless I am confused... how can a character be written to the LCD when the R/W (Read/Write) is tied to ground? I think you need to remove #define LCD_NO_RW.

     
  • kent_twt4

    kent_twt4 - 2014-10-28

    On the other hand, I have verified that the SYSTEMCALCTEMPX variable is not being properly initialized (ATTiny13A) when using the LCD.h library. Using SYNWRITE 0.9 28/4/2014, so apologies if this has been fixed since then.

     
  • Anobium

    Anobium - 2014-10-28

    @kent. We have an issue with SYSTEMCALCTEMPX. If you put a PRINT "" statement in the source file then this does initialise correctly.

    We will look into the root cause. Meanwhile, I would declare DIM SYSCALCTEMPX AS LONG as a fix.

    :-)

     
  • Theo

    Theo - 2014-10-28

    Thanks for your help, Anobium.

    Your solutions is helpfull for the compiling of the program (no error message) but I don't get any custom character on my lcd screen.

     
  • Anobium

    Anobium - 2014-10-28

    @Theo. I do not think you can create custom characters with the two wire method. You need to be able to change the state of the R/W. If you do this then it may work.

    By removing #define LCD_NO_RW and connecting the R/W on your chip to the R/W on the display may work - but, I have not tested or reviewed the code.

    I can provide a one wire method that use serial. It is alternative route to using a limited number of connections.

     
  • Chuck Hellebuyck

    I don't believe the R/W should matter when creating custom characters. Many years ago, I created custom characters on a 4x20 LCD so I could then create large digits. I did this for an article in my 2007 Nuts and Volts column "Getting Started with PICs". You only have 8 locations, 0-7, to load with the custom characters but the trick is you have to access the CGRAM area of the HD44780 chip. The R/W pin is grounded the whole time.

    I re-posted the article at my website. It explains the concept so even though it was written for the Basic Atom, it should be easy to adapt it to GCB.
    You can read more about it at my latest blog post with a link to the full article at:

    http://www.elproducts.com

     
  • Anobium

    Anobium - 2014-10-28

    @Chuck. Thank you. I should have tested my thoughts first. :-)

    @Theo - looks like a route to follow.

     
  • Theo

    Theo - 2014-10-29

    Thanks Anobium, Chuck and Kent, I agree with Chuck that R/W is not necessary for the creation of custom characters; I only need the write to the LCD not to read.

    With the example of the help file to send a custom character to the LCD I don't get any output at all on the LCD, so I created a new script with some commands to get something on the screen and indeed the LCDWriteChar command produces something, only not the expected result. Or I am writing to the wrong CGRAM address or the LCDWriteChar command reads from the wrong location or both?

    There is something strange, either the LCDCreateChar as the LCDWriteChar command do something; but both command do there job not 100%.

    New script:

    #chip mega8,8
    
    #include <74LS164.h> ; include My IO 74LS164
    
    'Use LCD in 2-wire mode with 74LS164 / 74HC164
    #define LCD_IO 2
    #define LCD_DB PORTC.0            ; databit
    #define LCD_CB PORTC.1            ; clockbit
    #define LCD_NO_RW
    
    'My own IO settings
    #define SWX PORTC.2               ; input pin from pushbuttons (A,B,C,D)
    #define Led PORTC.5               ; output pin for led
    #define SoundOut PORTC.0          ; output pin for tone
    Dir SWX in                        ; set port as input for pushbuttons
    
    DIM SYSCALCTEMPX AS long
    
    cls
    pulseout Led, 10 Ms               ; if active: program is running
    
    lcdcmd 64
    LCD_RS = On
    LCDBYTE = b'00000001'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'00000011'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'00000111'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'00001111'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'00011111'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'00111111'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'01111111'
    LCDNORMALWRITEBYTE
    LCDBYTE = b'11111111'
    LCDNORMALWRITEBYTE
    
    lcdcmd 2
    
    LCDWriteChar 0:Print " ":LCDWriteChar 1:Print " ":LCDWriteChar 2:Print " ":LCDWriteChar 3
    locate 1,0
    LCDWriteChar 4:Print " ":LCDWriteChar 5:Print " ":LCDWriteChar 6:Print " ":LCDWriteChar 7
    

    My problem is simular to
    https://sourceforge.net/p/gcbasic/discussion/579126/thread/03721f5c/#31eb

     

    Last edit: Theo 2014-10-29
  • Chuck Hellebuyck

    It sounds like a timing issue.
    Didn't the LCD source files get updated to a faster speed?
    Could it be affecting this?

    Isn't there a command to slow it down?
    I can't find it in the online help file.
    If you can find that, it may be worth a try.
    Or just run at a slower oscillator.

     
  • Anobium

    Anobium - 2014-10-30

    Try slower speed etc. If this fails. Please post all code, the layout of your solution (a diagram of the component layout etc.) and I will duplicate. I am travelling at the moment so this will take a day or two to get on test. I will hook up a protocol analyser to try and figure out what is going on.

     
  • pat

    pat - 2014-10-30

    I just tested gcBasic for the first time and i found the same bug.
    I work on XPsp2...

    I tested the Demo file "lcd light meter".
    The original file was with a µC PIC16F877 , it is a 40 pins chip and this sample use the 8 bits mode on portD.
    I compiled , it mahe it , OK.

    Now i change the µc for a Pic16F876 (the same µc full compatible, but it have just 28 pins , and no PORTD)
    The Data stay on PORTD just for test, I compiled ,it accepted the PORTD that is not exist on this µc
    It is the first problem, not very important , i change the PORT it is OK.

    Now I change the mode, for the 4 bits mode. And the great problem start...
    The compiler say to me , there is an error , the same you had.

    I search the LCD module that used by the compiler. (i think it is the define of the mode that added this module,...)
    I found it in the repertory "C:\GCB@Syn\GreatCowBasicinclude\low level\" , the lcd.H header.

    At the end i found some errors
    the SysLCDTemp define was in the wrong way
    SysLCDTemp define the output ou input not pin nunber that need 0 or 1

    Now it compiled fine.
    But I don't try it for the moment
    I correct this part of LCD.H;

    >#define  SysLCDTemp  LCD_DATA_PORT'Port to connect to LCD data bus. Used in 8-bit mode
    >
    >#define LCD_DB SysLCDTemp.0 'Data bit. Used in 2-bit mode
    >#define LCD_CB SysLCDTemp.0 'Clock bit. Used in 2-bit mode
    >
    >#define LCD_DB4 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    >#define LCD_DB5 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    >#define LCD_DB6 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    >#define LCD_DB7 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    >
    >#define LCD_RS SysLCDTemp.0 'Output bit to control LCD Register Select. Used as variable by 2-bit mode, and as a pin in 4 and 8 bit mode. DO NOT CHANGE FOR 2-BIT MODE.
    >#define LCD_RW SysLCDTemp.0 'Output bit to select read/write
    >#define LCD_Enable SysLCDTemp.0 'Output bit to enable/disable LCD
    >
    >#define LCD_RSTemp SysLCDTemp.0
    

    Edited (by Anobium)

    I hope the others demos will be better.

     

    Last edit: Anobium 2014-11-03
  • Anobium

    Anobium - 2014-11-03

    @pat - What was the date of LCD.H? I need this information to resolve this issue in the source code.

     
  • pat

    pat - 2014-11-04

    the date in the old zip;

    2007-01-15 20:59

    the date in the last I have download (same thing)

    2014-03-30 20:51

    more explanations;

    'I/O Ports
    define LCD_IO 4 'Number of pins used for LCD data bus (2, 4 or 8)

    **This line select the mode 4 bits, you have to select it in your prog not in the .H
    put it in comments...

    define LCD_DB SysLCDTemp.0 'Data bit. Used in 2-bit mode
    define LCD_CB SysLCDTemp.0 'Clock bit. Used in 2-bit mode

    **OK

    define LCD_DATA_PORT SysLCDTemp 'Port to connect to LCD data bus. Used in 8-bit mode

    **this line is inverted LCD_DATA_PORT is defined in the prog and below we use SysLCDTemp .
    You have 2 solution you change all the names below or you invert the 2 names

    define LCD_DB4 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    define LCD_DB5 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    define LCD_DB6 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode
    define LCD_DB7 SysLCDTemp.0 'Output bit to interface with LCD data bus. Used in 4-bit mode

    **OK

    define LCD_RS SysLCDTemp.1 'Output bit to control LCD Register Select. Used as variable by 2-bit mode, and as a pin in 4 and 8 bit mode. DO NOT CHANGE FOR 2-BIT MODE.

    **RS is an output put 0 not 1

    define LCD_RW SysLCDTemp.0 'Output bit to select read/write
    define LCD_Enable SysLCDTemp.0 'Output bit to enable/disable LCD

    **OK

    define LCD_RSTemp SysLCDTemp.2

    **I don't know what is this RStemp, but RS is an output, then put 0 not 1 or 2 , and 2 is not a boolean may be the compiler take 1 bit if it is a boolean (2 deci = 10 bin) i don't know how the compiler convert the type ...

     
  • Anobium

    Anobium - 2014-11-04

    @PAT. May I offer Skype or other alternative conf call to discuss? I am not understanding - please forgive me.

    Any evening or weekend is good - let me know via a Personal Message.

     
  • pat

    pat - 2014-11-07

    hello

    Do you receive my private mail?

     
  • Anobium

    Anobium - 2014-11-07

    yes..pop over to Skype. :-)

     
  • Theo

    Theo - 2014-11-12

    To prove that custom characters are possible in 2-wire LCD mode (with Atmega8), run the following program.

    The first part(step1 and 2)proves that the command LCDWriteChar is Ok, it shows 8 black fields for custom character 0 until 7(all bits are set)

    The second part(after 5 seconds) shows that it is possible to create and use custom characters in 2 wire LCD mode. It also showes that the command LCDCreateChar is not working in 2-wire LCD mode.
    (See my earlier comments)

    Have a nice day.

     #chip mega8,8
    
     #include <74LS164.h> ; include My IO 74LS164
    
     'Use LCD in 2-wire mode with 74LS164 / 74HC164
     #define LCD_IO 2
     #define LCD_DB PORTC.0            ; databit
     #define LCD_CB PORTC.1            ; clockbit
     #define LCD_NO_RW
    
     DIM SYSCALCTEMPX AS byte
    
     Locate 0,0
     Print "Step-1"
    
     'Draw the custom character
     locate 1,0
     for index = 0 to 7
        LCDWriteChar index:print " "
     next
    
     Locate 0,0
     Print "Step-2"
    
     wait 5 S
    
     'Create an array to store the character
     Dim AA(8)
     AA() = 27, 27, 0, 4, 0, 17, 17, 14
    
     cls
     Locate 0,0
     Print "Step-3"
     lcdcmd 64                              ; goto command mode; character loc 0
     Set LCD_RS On
     for index = 1 to 8
        LCD2_NIBBLEOUT Swap4(AA(index))     'Swap byte; Most significant NIBBLE sent first
        LCD2_NIBBLEOUT AA(index)            'Less Significant NIBBLE output
     next
     lcdcmd 128                             ; goto display mode
    
     Locate 0,0
     Print "Step-4"
     locate 1,0
     LCDWriteChar 0
    
     

    Last edit: Theo 2014-11-12
  • Theo

    Theo - 2014-11-13

    In conjuction with custom characters a weird thing happened;

    I was figuring out how to create custom characters in 4-wire lcd mode(with atmega8), so i used the demo(LCDCreateChar) from the helpfile. Using the name for the array(TempArray) the displayed character was corrupted.
    By using the name AA or anything else (not starting with temp)for the array, the displayed characters were 100%.

    Maybe the help file should be changed or the compiler examined if variables starting with temp are causing problems.

    Kind regards.

     
  • Jack Hoffnung

    Jack Hoffnung - 2014-11-23
    Thanks to Theo for helping me figure out how to get custom characters to work
     in 2-line mode.  I modified his code for the Atmega8 to work with my 12F683.  
     Below is a program that yields an 8 custom character animation.
    
    ;Custom character animation loop; 2-wire mode used
    
    #chip 12F683,8                              ;PIC12F683 running at 8 MHz
    #config mclr=on                             ;reset handled manually
    #config osc=int                              ;use internal clock
    ;relevant constants for 2-wire mode------------------------------------
    #define LCD_IO 2
    #define LCD_DB    GPIO.0            ;shift register data on GP0, pin 7
    #define LCD_CB    GPIO.1            ;shift register clock on GP1, pin 6
    
    dim index, cc, dd as byte                ;custom character bytes
    dim counter as byte                         ;for display routine
    
    ;Create all 8 custom characters----------------------------------------
    Dim AA(64)
    AA() = 0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x00         ;custom character 0
         = 0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x00         ;custom character 1
         = 0x00,0x02,0x02,0x08,0x08,0x00,0x00,0x00         ;custom character 2
         = 0x00,0x00,0x02,0x02,0x08,0x08,0x00,0x00         ;custom character 3
         = 0x00,0x00,0x00,0x06,0x00,0x0C,0x00,0x00         ;custom character 4
         = 0x00,0x00,0x00,0x0C,0x00,0x06,0x00,0x00         ;custom character 5
         = 0x00,0x00,0x08,0x08,0x02,0x02,0x00,0x00         ;custom character 6
         = 0x00,0x08,0x08,0x02,0x02,0x00,0x00,0x00         ;custom character 7
    
    ;Write all 8 characters into CGRAM-------------------------------------
    cc = 1 : dd = 8
    lcdcmd 64                               ;go to base address character 0 in CGRAM
    
    Do
    Set LCD_RS On           ;since R/W is grounded (0), RS on (1) yields the WRITE command
    for index = cc to dd                ;array elements
    LCD2_NIBBLEOUT Swap4(AA(index))     ;swap byte; msnwritten first
    LCD2_NIBBLEOUT AA(index)            ;lsn next
    next
    cc = cc + 8 : dd = dd + 8           ;next custom character
    If cc > 64 then goto display        ;all array elements have been read
    loop
    
    display:                            ;displays custom characters in rapid sequence
    Do
    For counter = 0 to 7
    locate 0,0 : LCDWriteChar counter
    wait 200 ms
    next
    loop
    
     
  • Jack Hoffnung

    Jack Hoffnung - 2014-11-25
    OOPS. My last post had an error; all the array elements need to be on the same line:
    AA() = 0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x02,0x02,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x06,0x00,0x00,0x00,0x00,0x08,0x08,0x02,0x02,0x00,0x00,0x00,0x08,0x08,0x02,0x02,0x00,0x00,0x00
    
     
  • Anobium

    Anobium - 2014-11-25

    @Jack. Would you post the code as an attachment? I would like to use this an example in the Help File.

    Is this ok?

     
1 2 > >> (Page 1 of 2)

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.