Menu

Odd LCD issue

2016-10-17
2016-10-18
  • Sleepwalker3

    Sleepwalker3 - 2016-10-17

    Hi,

    I'm having an odd problem with GCB 0.95.009 2016-08-09 when using a 20 x 4 LCD (RT204-1). When I do a simple 'Hello world" print repeatedly in a loop, it first prints on line 0 (the 1st line), then prints on line 2 (3rd line), then on line 1 (2nd line), then on line 3 (4th line). Two lots of "Hello World" doesn't quite fit on 1 line, so it wraps the text (as you would expect), but the remainder of that text comes up on the 3rd line, not the second!.

    Put more simply, it prints line 1, 3, 2, 4 instead of the expected 1, 2, 3, 4.

    I found this when making a more complicated program which worked fine other then this odd printing, so I made a simple test program to check.

    I made the program as simple as it can be, it simply loops around printing the same thing, with a small delay to allow the display order to be seen.

    This appears to be a problem in the LCD routines, but as I'm just a beginner on GCB, perhaps I'm missing something? Can anybody try this an confirm please?

    Thanks

    '-------------
    #Option Explicit
    
    'Hardware settings
    '18F2550 Chip, ChipMHz
    #chip 18F2525, 8
    #config OSC = INTIO67, MCLRE_ON
    
    'LCD connection settings
    
      #define LCD_IO 4
      #define LCD_NO_RW                     'RW Not needed, can be linked to 0V
      #define LCD_RS PORTC.0            'Pin 3 of PIC
      #define LCD_Enable PORTC.1    'Pin 4 of PIC
      #define LCD_DB4 PORTA.0           'Pin 5 of PIC
      #define LCD_DB5 PORTA.1           'Pin 6 of PIC
      #define LCD_DB6 PORTA.2           'Pin 7 of PIC
      #define LCD_DB7 PORTA.3           'Pin 8 of PIC
        #define LCD_Speed slow
    
    CLS
    
    looppoint:
        Print "Hello World."
        wait 800 ms
        goto looppoint
    End
    
     
  • Anobium

    Anobium - 2016-10-17

    Also, see http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html

    The LCD addressing is as shown in the URL above. Simple printing string after string will give the effect you are getting. You need use Locate to position the cursor and/or write your own sub that permits you to Print string after string and have them strings appear one line 1, then line 2 and 3 and 4 etc. I am sure that someone has some working routines to support this.

    Otherwise, use locate.

    Or, I can sell you a K107 LCD driver pack that supports this!

     

    Last edit: Anobium 2016-10-17
  • Sleepwalker3

    Sleepwalker3 - 2016-10-18

    Thanks Anobium, that explains a lot. I'm amazed I haven't come across that before. I'm also a bit amazed that they haven't come out with some sort of updated LCD chip that can be setup to work as anybody would logically expect. Anyway, I now see why this problem exists.

    Because of the nature of the project I'm working on, the characters will be a small sequence of characters (typically 4 characters at a time), one sequence after another, so I'll have to keep track of how many characters I'm displaying and juggle the locations appropriately.

    Thanks again for your time.

     
    • Anobium

      Anobium - 2016-10-18

      Pleasure. It had me fooled for a few moments, then, I remembered that URL.

       

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.