Replace the PRINT command to use I2C backpack on 1602 LCD - Page 18


+ Reply to Thread
Page 18 of 18 FirstFirst ... 8161718
Results 256 to 264 of 264
  1. #256
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    I'm a bit late to the party George, but you've done a brilliant job of the I2C Backpack code. just set one up here, and I had it working within 15 mins.

    Regards
    John

Attention
×

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #257
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,269
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    John, Mellbreak, Tim and John - you're welcome. Actually but for Mellbreak it would of been one of those - it doesn't work sometimes for no reason - things.
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #258
    Klr650
    Guest Klr650's Avatar

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    For over 10 years I've been using LCDs with daughter boards attached - the board has a PIC that accepts RS232 data and provides the required drive for the parallel LCD. So to print text you just use RSOUT - nice and simple. These aren't available anymore though so its time to move on. Forgive me if this is a stupid question but why hasn't this sort of thing been done for I2C instead of using this complicated port expander chip thing?

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #259
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,269
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    One word, cost. Bear in mind these boards are available for half nothing. No reason not to build your own board and Crownhill are selling one (has its own PIC so you can reprogram it for pretty much ant interface).
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #260
    Junior Member andy wong's Avatar
    Join Date
    Mar 2005
    Posts
    15
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    845.29 MB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    Nowadays, I2C backpack has PCF8574A on it; "I2CPrint_Control" should be changed to %01110000 from %01000000. Took me a while to figure out.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #261
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,269
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    Hi Andy, I suspect you may not have the latest version

    From history of I2CPrintHardCommand.inc
    Code:
    0.10.0 - CLEAR added (the jury still out on this - it can't do any harm) and constant for PCF8574A

    This define
    Code:
    $define I2CPrint_NonA                         ' this is PCF8574 REM out for PCF8574A
    I see now that I forgot to add that to I2CPrintSoftCommand.inc (the I2C bit bang version).
    Last edited by towlerg; 8th February 2018 at 15:56.
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #262
    Junior Member pjdenyer's Avatar
    Join Date
    Sep 2018
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.26 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    I am trying to use this with Proton 24 on a 33FJ128GP802, I have made 1 change to the Inc file

    Dim BPF As Byte System


    is now

    Dim BPF As Word System - proton24 uses Word system variables

    When I compile I get the error

    ASM ERROR : Assembler Error at Line [2461] Invalid mnemonic 'print'


    ; rd_i000030_f002_000083_p000016,0 mkr$ in [i2cprinthardcommand.inc] clear

    Clr.w W0


    Mov.w #2168,W1

    Repeat #8071
    Mov.w W0,[W1++]

    ; rd_i000031_f002_000084_p000016,0 mkr$ in [i2cprinthardcommand.inc] goto i2cprintcommand_end
    GoTo I2CPrintCommand_End

    ;[s_asm]
    Print ***** HERE *****

    ;[e_asm]
    Wreg_Byte I2CPrint_PrintStore

    ; rd_i000032_f002_000089_p000016,0 mkr$ in [i2cprinthardcommand.inc] if i2cprint_tinitialised = 0 then
    Btsc.b BPF,#1

    Bra _lbl__5



    ; rd_i000033_f002_000090_p000016,0 mkr$ in [i2cprinthardcommand.inc] hbusout i2cprint_address,[i2cprint_init1_e]




    Anyone any ideas???


  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #263
    Senior Member Mellbreak's Avatar
    Join Date
    Jun 2012
    Posts
    562
    Thumbs Up
    Received: 36
    Given: 25
    Total Downloaded
    4.47 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    See if the following helps you......

    Code:
     '*****************************************************************************************************************
    '*  Name    : I2CPrintCommand.bas                                                                                 *
    '*  Purpose : allow Proton Print commands to access the standard 1602 LCD via I2C serial board                    *
    '*  Author  : George Towler                                                                                       *
    '*  Notice  : I claim no copyright but maybe Barak does                                                           *
    '*  Date    : 26/08/2013                                                                                          *
    '*  Version : 0.1.2                                                                                               *
    '*  Notes   : see http://www.protonbasic.co.uk/showthread.php/62478-%93Print%94-command-for-SPI-Alfa-numeric-LCD  *                                                  *
    '*          :     post #6   Barak shows how to replace Proton commands and how to deal with control (FE$) bytes   *
    '*          : 15/12/2013 - Modifications made to the original code so it runs with Proton24 made by Bob Marshall. *
    '*          : This code is a cut down version of the original program posted by George Towler. George's code      *
    '*          : full code can be found at:-                                                                         *
    '*          : http://www.protonbasic.co.uk/showthread.php/70173-Replace-the-PRINT-command-to-use-I2C-backpack-on-1602-LCD
    '*          : The version of this code for Proton24 is somewhat experimental! Please use with care.               *
    '*                                                                                                                *
    '******************************************************************************************************************
    
    
        Device =  24HJ128GP502
    
        #Disable Print                           ' put the disable after config fuses
    
        Declare Xtal = 32
        Declare I2C_Slow_Bus On
        Symbol Part_address    = $0E         ' PCF8574 Slave Address 0,1,0,0,A2,A1,A0,RW  where W=0         
        Symbol InitForLCDLines = $28         ' $28 for two lines                                            
    
    
        Symbol LCD_RS          = %00000001  ' P0                                                           
        Symbol LCD_RW          = %00000010  ' P1                                                           
        Symbol LCD_E           = %00000100  ' P2                                                           
        Symbol BackLight       = %00001000  ' P3 Backlight
                                            ' Data on p4 - p7
                                            
        Symbol BackLight_RS   = BackLight | LCD_RS
        Symbol BackLight_E    = BackLight | LCD_E
        Symbol BackLight_RS_E = BackLight | LCD_RS | LCD_E
        Symbol Control = %01000000
        Symbol Address = Control + Part_address
    
        Symbol Init1          = %00110000 | BackLight
        Symbol Init1_E        = %00110000 | BackLight | LCD_E
        Symbol Init2          = %00100000 | BackLight
        Symbol Init2_E        = %00100000 | BackLight | LCD_E
    
    
        Symbol sda = PORTB.7
        Symbol scl = PORTB.6
         
        Dim PrintData As Byte
        Dim HighData As Byte
        Dim LowData As Byte
        Dim dummy As Byte
        Dim RSFlag As Byte
        Dim test As SDword = -1234678
        Dim Flt As Float = 3.142 
        Dim one As Byte  = $82
        Dim two As Byte
        Dim three As Byte
        
        
        GoTo Boot 
        
        __Print:' assembler Print redirect 
        Wreg_Byte PrintData    
        GoTo LCD_WriteData
    
      '***[Start here]****************************
        Boot:
        DelayMS 500
        GoSub PrintInit
        
    ' You're Main goes here, delete the test below, don't forget to set the address and the correct InitForLCDLines
    
    
        Main:                                       
    
        
        While
    
            Cls
            DelayMS 500
            Print At 1,4,"Hello World"                 ' test printing at coordinates At x,y,
            DelayMS 1000
            Print 0xFE,0x01                            ' test sending a comad 0x01 is Cls
            DelayMS 500
            Flt = 3.14519453466                        ' Floating point number test
            Print At 2,5, Dec8 Flt                     ' test printing a formated number
            DelayMS 2000
            Cls
            Cursor 1,2                                 ' test moving the cursor
            Print "Signed Number"
            Print At 2,4,SDec test                     ' Test signed DWORD 
            Inc test
            DelayMS 2000
    
        Wend
    
    ' ****************************************************************************
    ' **                             S U B R O U T I N E S                      **
    ' ****************************************************************************
    
        SendData:
        
        HighData = PrintData & %11110000   ; mask LSBs
        LowData = PrintData << 4           ; shift left
    
        dummy = BackLight_RS_E | HighData    ; data and e hi
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight_RS | HighData      ; data and e lo
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight_RS_E | LowData     ; data and e hi
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight_RS | LowData       ; data and e lo
        I2COut  sda,scl, Address, [dummy]
        Return
    
    
        SendControl:
        
        HighData = PrintData & %11110000   ; mask LSBs
        LowData = PrintData << 4           ; shift left
    
        dummy = BackLight_E | HighData       ; data and e hi
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight | HighData         ; data and e lo
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight_E | LowData        ; data and e hi
        I2COut  sda,scl, Address, [dummy]
        dummy = BackLight | LowData          ; data and e lo
        I2COut  sda,scl, Address, [dummy]
        DelayMS 20
        Return
    
    
        PrintInit:
    
        I2COut  sda,scl, Address, [Init1_E]       ; E hi and send command nibble 0011 (3)
        I2COut  sda,scl, Address, [Init1]         ; E lo
        DelayMS 20
        I2COut  sda,scl, Address, [Init1_E]       ; E hi and send command nibble 0011 (3)
        I2COut  sda,scl, Address, [Init1]         ; E lo
        DelayMS 20
        I2COut  sda,scl, Address, [Init2_E]       ; E hi and send command nibble 0010 (2)
        I2COut  sda,scl, Address, [Init2]         ; E lo
        DelayMS 20
        PrintData = InitForLCDLines      ; 4 bit mode and n lines
        GoSub SendControl
        PrintData = $0C                  ; enable display, cursor and blink off
        GoSub SendControl
        PrintData = $06                  ; move cursor after each write
        GoSub SendControl
        PrintData = $80                  ; goto column 1 line 1
        GoSub SendControl
        Return
    
        LCD_WriteData:' prepare to write a data byte
    
        Push WREG2
        Push WREG8
        
        If PrintData = 0xFE Then           ' it is a command header
            RSFlag = 0                     ' clear a flag so we know the next byte will be a command
        Else
            If RSFlag = 0 Then
                GoSub SendControl
            Else
                GoSub SendData
            EndIf
            RSFlag = 1                      ' set the flag so the next byte will be send as Data
        EndIf
        
        Pop WREG8
        Pop WREG2
        Return

    I don't have a 33FJ128GP802 to test it on, but it does assemble. Note the two underscores on the print label __Print NOT _Print


    Bob
    Last edited by Mellbreak; 1st November 2018 at 22:34.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #264
    Junior Member pjdenyer's Avatar
    Join Date
    Sep 2018
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.26 GB

    0 Not allowed!

    Default Re: Replace the PRINT command to use I2C backpack on 1602 LCD

    Thanks Bob worked first time

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. I2C Lcd Print & Owrite
      By pic-ignorant in forum The Lounge
      Replies: 1
      Last Post: 5th June 2017, 17:35
    2. Replies: 20
      Last Post: 15th August 2015, 16:13
    3. “Print” command for SPI Alfa numeric LCD?
      By barak in forum LCD module
      Replies: 16
      Last Post: 9th February 2011, 11:43
    4. Print command LCD alpha BUG
      By Flying Canuck in forum Proton Plus Compiler v3
      Replies: 26
      Last Post: 26th March 2010, 03:21
    5. [SOLVED !] LCD Print command and display justification
      By Sparky1039 in forum Proton Plus Compiler v3
      Replies: 3
      Last Post: 16th July 2007, 22:24

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts