Menu

LCD locate x, y not working?

Help
MBB
2018-03-28
2018-03-30
  • MBB

    MBB - 2018-03-28

    I'm using version 98.01 with an 18F452 and #define LCD_IO 2 which uses a 74LS174 shift register and the circuit shown at this link:
    http://gcbasic.sourceforge.net/library/DIAGRAMS/2-Wire%20LCD/2-wire%20LCD%2074LS174%20(LCD_IO%202_74xx174%20-%20pre%20Aug2015).JPG

    When I write:
    locate 0, 0 or locate 1, 0 it prints at the correct location.

    When I write :
    locate 2, 0 or locate 3, 0 it incorrectly prints at location 2, 4 or 3, 4, respectively.

    I'm using 16x 4 displays. One uses the HD44780 chip and the others uses a chip with a paper label over it with UC-16401 on it. I pealed the label off but still couldn't read the number.

    I tried this with an 18F4550 but got the same results.

    When I used an old 20x4 LCD it worked correctly with both PICs.

    Any ideas?

     
  • Anobium

    Anobium - 2018-03-28

    Slow down the transmission.

    Specfic LCD may need slower communications.

    #DEFINE LCD_SPEED  SLOW
    
     
  • MBB

    MBB - 2018-03-29

    I tried #DEFINE LCD_SPEED SLOW but it didn't help.

    Any other ideas?

     
    • Anobium

      Anobium - 2018-03-29

      Ummm. Let me check the issue with you.

      So, same source code? Same version of Great Cow BASIC. Correct? but, this specific device does not work as expected.

       
  • MBB

    MBB - 2018-03-29

    Yes, all the same. This LCD does not work as expected.

     
    • Anobium

      Anobium - 2018-03-29

      Tried hitting it?

      On a more serious note.... Try increasing the delays. This does sound like a timing issue on a specifically slow LCD. These are the parameters I can see. Try settle these to very high value.. maybe 255 then if this fixes the issue bring them down.

      Set these in the user program.

      #define LCD_Write_Delay 2 us  ' now change all delays
      #define slow_us 80
      
       
  • MBB

    MBB - 2018-03-29

    I tried the above suggestion and got the same results. I tried different delay times up to 255 but got the same results.

    I also tried in #define LCD_IO 8 mode but still the same results.

     
  • MBB

    MBB - 2018-03-29

    In the lcd.h include file is the following SUB:

            Sub LOCATE (In LCDLine, In LCDColumn)
                      Set LCD_RS Off
                      If LCDLine > 1 Then
                                LCDLine = LCDLine - 2
                                LCDColumn = LCDColumn + 20
                      End If
    
                      LCDWriteByte(0x80 or 0x40 * LCDLine + LCDColumn)
                      wait 5 10us 'test
            End Sub
    

    In the line that reads : LCDColumn = LCDColumn + 20 If I change the "20" to "16"
    LCDColumn = LCDColumn + 16

    It now works correctly. Is this because I'm using 16x4 display? If so is there some code I can add to my program to over ride the "20"?

     
  • Anobium

    Anobium - 2018-03-29

    You are correct!

    Try the attached.

    Add the following to your program.

    #define lcd_width 16

     
  • MBB

    MBB - 2018-03-29

    Thanks! It works now.

     
  • Anobium

    Anobium - 2018-03-29

    I will document   and promote to release.

     

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.