Menu

GCB Basic Locate 1,0 no second row. RESOLVED. Incorrect chip selected.

Romtek
2023-02-08
2023-02-12
<< < 1 2 (Page 2 of 2)
  • Romtek

    Romtek - 2023-02-09

    sorry if I reply now but I've been busy, I'll try the program for the weekend, greetings

     
    • Anobium

      Anobium - 2023-02-09

      No problem. I look forward to the test results.

       
  • Romtek

    Romtek - 2023-02-10

    I tried it on mega8515, also adding this modification
    #DEFINE LCD_SPEED 255 (signals compiler"code /constant lcd_speed equates to slow cannot reassigned to equate to 255 ....")
    the result is the following:
    20, 0, 0, 128

    20, 1, 0, 128
    see attached photo``

     

    Last edit: Anobium 2023-02-10
  • Anobium

    Anobium - 2023-02-10

    Can you attach the following four file. 1. Source for PIC 2. ASM for PIC 3. Source for AVR 4. ASM for AVR

    The 2nd value of 20, 1, 0, 128 should be 20, 1, 0, 192 - if the programs are the same. So, we are getting close to figuring out the root cause.

    If you need to.. ZIP the four files and attach.

     
  • Anobium

    Anobium - 2023-02-10

    And, change the line that was similar...
    Make it read in both case.
    Retest.

    HSerPrint ((0x80 or 0x40 * LCDLine)+ LCDColumn)

    This line of code is similar to the line of code in LCD.h. As the value that should 192 is 128 there has to be something going on with respect to the calculation - it may be maths precedence hence the new line of code above.

    If this shows the correct values on both chips then I will change LCD.h to resolve on the LCD.

     

    Last edit: Anobium 2023-02-10
    • Romtek

      Romtek - 2023-02-10

      I also tested on pic16f88 with

      #DEFINE LCD_SPEED 255
      

      and it works, from the serial the values are
      20, 0, 0, 128

      20, 1, 0, 192
      now I send the files you asked for ......

       
      • Romtek

        Romtek - 2023-02-10

        Sorry, (Preface for each test both 8515 and pic16f88 I connect 2x16 and also 4x16 lcds).
        Let's recap: with the mega8515 all the changes have not led to the solution, i.e. the display shows (on the 2x16 lcd)
        1.0
        0

        20, 0, 0, 128

        20, 1, 0, 128
        while on 4x16 lcd displays
        1.0
        0.1

        20, 0, 0, 128

        20, 1, 0, 128

        I did the same tests on pic 16f88 and everything works.
        Thanks for now

         
        • Romtek

          Romtek - 2023-02-10

          I think it would be good to focus on mega8515 to see if it can fix it!!???

           
          • Romtek

            Romtek - 2023-02-10

            I think it would be a good idea that when starting the program, before going to write on the lcd, pause for 500 mS

             
  • Anobium

    Anobium - 2023-02-10

    OK. Add the following to the test programs. This is use this modified LOCATE sub. Test and report.

    Add this at the bottom of your existing programs.

    #DEFINE LOCATE MYLOCATE
    Sub MYLOCATE (In LCDLine as Byte, In LCDColumn as Byte)
    'Sub to locate the cursor
    'Where LCDColumn is 0 to screen width-1, LCDLine is 0 to screen height-1
    
        Set LCD_RS Off
        If LCDLine > 1 Then
            LCDLine = LCDLine - 2
            LCDColumn = LCDColumn + LCD_WIDTH
        End If
    
        LCDWriteByte((0x80 or (0x40 * LCDLine))+ LCDColumn) 
        wait 5 10us
    End Sub
    
     
    • Romtek

      Romtek - 2023-02-10

      Sorry but I don't understand, I send you what I did on 8515 with the last change hoping it will help you .(in the file I commented the Mine part that works and Yours part that doesn't work )

       
  • Anobium

    Anobium - 2023-02-10

    I am confused,

    Please revert back the initial code with the locate 0,0 to locate 3,0. No mods with ,80 etc. We need to find the root cause. Then add the code I posted

    #DEFINE LOCATE MYLOCATE
    Sub MYLOCATE (In LCDLine as Byte, In LCDColumn as Byte)
    'Sub to locate the cursor
    'Where LCDColumn is 0 to screen width-1, LCDLine is 0 to screen height-1
    
        Set LCD_RS Off
        If LCDLine > 1 Then
            LCDLine = LCDLine - 2
            LCDColumn = LCDColumn + LCD_WIDTH
        End If
    
        LCDWriteByte((0x80 or (0x40 * LCDLine))+ LCDColumn) 
        wait 5 10us
    End Sub
    

    To get on the same page - attached is a new baseline.

    Test and let me know what happens.

     
  • Anobium

    Anobium - 2023-02-10

    This is what I am getting. See the picture.

    i have tested on an UNO - that works great.

     

    Last edit: Anobium 2023-02-10
    • Romtek

      Romtek - 2023-02-11

      Maybe I found the reason where I was wrong....
      In the program I wrote:

      chipmega8515, 4

      while in reality the micro I'm using is an AT90S8515 8PI ,
      I recommend using an ATMEGA8515.
      I solved by putting

      chip 90s8515, 4

      and on the display (with PCF8574 i2c interface) it shows the writings correctly.
      I still have the doubt that the library only manages 2-line displays and not 4-line ones, correct me if I'm wrong.
      In fact, lines 3 and 4 now appear shifted.
      Thank you all and patience for the replies.
      I add that I'm using a 4 MHz quartz

      ;Chip Settings
      'error not use #chip mega8515, 4
      #chip 90s8515, 4
      
      #include <pcf8574.h>
      #option explicit
      
      
      ; ----- Define Hardware settings
         ' THIS CONFIG OF THE SERIAL PORT TO A PC TERMINAL via a TTL Converter
         ' USART settings
         #define USART_BAUD_RATE 19200 '!!!!!errore libreria velocita a 9600
         Dir PORTA.3 Out
         Dir PORTA.4 In
         #define USART_DELAY 10 ms
         #define USART_BLOCKING
      
      
         #define led PortB.0 ' up port b0
         Dir led Out ' out led
      
        ; ----- Define Hardware settings
        ' Define I2C settings - CHANGE PORTS
         #define I2C_MODE Master
         '#define I2C_DATA PORTB.0 'pin 25
         '#define I2C_CLOCK PORTB.1 'pin 24
         #define I2C_DATA PORTC.4 'pin 25
         #define I2C_CLOCK PORTC.3 'pin 24
         #define I2C_DISABLE_INTERRUPTS ON
         #define I2C_BIT_DELAY 0 us     '0
         #define I2C_CLOCK_DELAY 1 us   '1
         #define I2C_END_DELAY 0 us     '0
         #define LCD_IO 10
         #define LCD_I2C_Address_ 0x4E
        ' #define LCD_I2C_Address_1 0x4E
      
        '''Set up LCD
         'You may need to use SLOW or MEDIUM if your LCD is a slower device.
         '#define LCD_SPEED SLOW 'FAST
         '#define LCD_SPEED MEDIUM   
         #define LCD_SPEED FAST
      
         'led display.
         #define LCD_Backlight_On_State  1
         #define LCD_Backlight_Off_State 0
      
      
      ; ----- Quick Command Reference:
      
       '''Set LCD_10 to 10 for the YwRobot LCD1602 IIC V1 or the Sainsmart LCD_PIC I2C adapter
       '''Set LCD_10 to 12 for the Ywmjkdz I2C adapter with pot bent over top of chip
      
      ' variabili
      'Dim yy As byte   'no use
      'Dim xx As byte  'no use
      'i =0
      
      ; ----- Main body of program commences here.
      Inittimer1 OSC, PS_64
      Starttimer 1
      Settimer 1, 50 ;Preload Timer
      On Interrupt Timer1Overflow Call Flash_LED
      
      Sub Flash_LED
      Settimer 1, 50 'Preload timer
         led=!led 'inverto led
         'pulseout led, 100 ms
      End Sub
      '--------------------------------------------------------------------------------------
          HSerPrint "test uart!!!!!!!!"
          HSerSend 13
          HSerSend 10
      
          'blink lcd
          LCDBacklight OFF
          WAIT 500 ms
          LCDBacklight ON
          CLS
          WAIT 500 ms
      
      
       Do Forever
          /*cls
          locate 0,0
          PRINT "DISPLAY ON 1 row"
          locate 0,40 '2row
          PRINT "DISPLAY ON 2 row"
          locate 0,16  '3 row
          PRINT "DISPLAY ON 3 row"
          locate 0,80 '4row
          PRINT "DISPLAY ON 4 row"
          wait 5 s
          */
          cls 
      
          locate 0,0
          PRINT "locate 0,0"
          Locate 1,0 '2 row
          PRINT "locate 1,0"
          Locate 2,0  '3row
          PRINT "locate 2,0"
          Locate 3,0 '4 row
          PRINT "locate 3,0 "
          wait 5 s
      
          loop
      
      
      end
      
       
  • Anobium

    Anobium - 2023-02-11

    oh dear.. yes, a waste of time re the chip.

    The library works. We would have been told by our many 1000s of users.. if it did not.

     
    • Romtek

      Romtek - 2023-02-11

      The fact remains that the same program on PIC16f88 4 MHZ
      (i2c PCF8574) lines 3 and 4 are moved.
      I can't explain it.
      See listing.
      Sorry for the previous error.

      ;Chip Settings
      #chip 16F88,4
      
      #include <pcf8574.h>
      #option explicit
      
      
      ; ----- Define Hardware settings
         ' THIS CONFIG OF THE SERIAL PORT TO A PC TERMINAL via a TTL Converter
         ' USART settings
         #define USART_BAUD_RATE 19200 '
         Dir PORTA.3 Out
         Dir PORTA.4 In
         #define USART_DELAY 10 ms
         #define USART_BLOCKING
      
      
         #define led PortA.2 'up port b0
         Dir led Out ' out led
      
        ; ----- Define Hardware settings
        ' Define I2C settings - CHANGE PORTS
         #define I2C_MODE Master
         #define I2C_DATA PORTB.0 'pin 25
         #define I2C_CLOCK PORTB.1 'pin 24
         #define I2C_DISABLE_INTERRUPTS ON
         #define I2C_BIT_DELAY 0 us     '0
         #define I2C_CLOCK_DELAY 1 us   '1
         #define I2C_END_DELAY 0 us     '0
         #define LCD_IO 10
         '#define LCD_I2C_Address_ 0x4E
         #define LCD_I2C_Address_1 0x4E
      
        '''Set up LCD
         'You may need to use SLOW or MEDIUM if your LCD is a slower device.
         #define LCD_SPEED SLOW 
         '#define LCD_SPEED MEDIUM   
         '#define LCD_SPEED FAST
      
         'retro  display.
         #define LCD_Backlight_On_State  1
         #define LCD_Backlight_Off_State 0
      
      
      ; ----- Quick Command Reference:
      
       '''Set LCD_10 to 10 for the YwRobot LCD1602 IIC V1 or the Sainsmart LCD_PIC I2C adapter
       '''Set LCD_10 to 12 for the Ywmjkdz I2C adapter with pot bent over top of chip
      
      ' variabili
      'Dim yy As byte  'no use
      'Dim xx As byte  'no use
      'i =0
      
      ; ----- Main body of program commences here.
      Inittimer1 OSC, PS_64
      Starttimer 1
      Settimer 1, 50 ;Preload Timer
      On Interrupt Timer1Overflow Call Flash_LED
      
      Sub Flash_LED
      Settimer 1, 50 'Preload timer
         led=!led 'blink led
         'pulseout led, 100 ms
      End Sub
      '--------------------------------------------------------------------------------------
          HSerPrint "twat uart 16f88"
          HSerSend 13
          HSerSend 10
      
          'blink
          LCDBacklight OFF
          WAIT 500 ms
          LCDBacklight ON
          CLS
          WAIT 500 ms
      
      
       Do Forever
          cls
          locate 0,0
          PRINT "DISPLAY ON 1 row"
          locate 0,40 '2 row
          PRINT "DISPLAY ON 2 row"
          locate 0,16  '3 row
          PRINT "DISPLAY ON 3 row"
          locate 0,80 '4 row
          PRINT "DISPLAY ON 4 row"
          wait 5 s
      
          cls 
      
          locate 0,0
          PRINT "locate 0,0"
          Locate 1,0 '2 row
          PRINT "locate 1,0"
          Locate 2,0  '3 row
          PRINT "locate 2,0"
          Locate 3,0 '4 row
          PRINT "locate 3,0 "
          wait 5 s
      
          loop
      
      
      end
      
       
  • Anobium

    Anobium - 2023-02-11

    We resolved that on Thursday. Go back through the posts.

     
    • Romtek

      Romtek - 2023-02-11

      I don't know what solution you are referring to on Thursday.

      1)Have you tried TO USE WITH (PCF8574) ON A 4 LINE DISPLAY??

      2) did you see the photos I attached??

      If you can kindly answer me thank you.

      SORRY I INSIST BUT IF I DON'T KNOW WHERE I'M WRONG.

       
      • Anobium

        Anobium - 2023-02-11
        1. Yes. It works fine.
        2. Yes.

        Attach your code please. ATTACH do not paste into a post.

         
        • Romtek

          Romtek - 2023-02-11

          Thanks for your infinite patience, attached the file on 16f88

           
          • Anobium

            Anobium - 2023-02-11

            Please add the geometry of the LCD. By set the LCD_WIDTH to 16

            #DEFINE LCD_WIDTH 16

            The only way I get your display is to set my width to 24. So, the memory map/addressing in the LCD is different? But, you said it worked with Arduino... my guess you set the geometry to 1604.

            Try again and report please.

             
            🎉
            2
            • Romtek

              Romtek - 2023-02-11

              Thanks thanks thanks, thanks again, Solved Solved!!!! (I shout it to the world :) )
              So I tested it both on pic 16f88 and 90s8515 with 16x2 and 16x4 lcd
              and displays the writings in the right position.
              For those who have problems with placement of text on lines ( Locate 0,0 Locate 1,0 Locate 2,0 Locate 3,0) add the following command #DEFINE LCD_WIDTH 16 (which if I'm not mistaken defines lcd 16 characters)
              Thank you all for your patience and time spent.
              This experience has taught me not to leave anything to chance but to analyze point by point.
              Thanks Anobium

               
              👍
              1
              • Romtek

                Romtek - 2023-02-11

                I attach the photo of the result

                 
                • Romtek

                  Romtek - 2023-02-11

                  I would recommend modifying the manual where the example of the lcd is shown. For beginners and beginners like me, normally if one copies the example (see online help page 404) and uses a 16x2 or 16x4 LCD, one finds himself with the same problem as me.
                  So I would add #DEFINE LCD_WIDTH 16 in the example since 16x2 lcds are commonly sold.
                  I hope with my post can help others, greetings thanks.

                   
  • Anobium

    Anobium - 2023-02-12

    Great to see you have it all operational.


    Also, a great idea to improve the Help.

    I will update the Help. Check the Help distributions later today for the revisions.

    I have also updated a lot of the demos specifically related to LCD operations ( about 100 demos) to explicitly state #define LCD_WIDTH 20 ;specified lcd width for clarity only. 20 is the default width so the users will see this constant.

    :-)

    Enjoy

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.