Interfacing with Arduino I2C LCD


Closed Thread
Results 1 to 40 of 48

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    I am trying to make this code work with a 16F629A and all I get is a blinking back light with the modified code below.I am probably missing something simple?

    Thanks,

    ; Filename : Test_LCD_PCF8574.pbp
    ; Author : Darrel Taylor
    ; Created : Mon Feb 24 2014
    ; Processor : 16F629A
    ; Compiler : PicBasic Pro 3.0.6.x or higher
    ; Description : Uses PCF8574 Port expander to interface with HD44780 LCD
    ;

    ;----[16f629A Hardware Configuration]-------------------------------------------
    #config
    __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_ON & _BODEN_OFF
    #endconfig



    ;----[Aliases]------------------------------------------------------------------
    SDA var porta.7
    SCL var porta.6
    ;----[Initialize Hardware]------------------------------------------------------
    CMCON = 7 'CHANGES PORTA TO DIGITAL
    ;----[Setup LCD using PCF8574 Port Expander]------------------------------------
    LCD_Addr CON $7E
    INCLUDE "LCD_PCF8574.pbp" ; Include LCD module for PCF8574

    ;----[Variables]----------------------------------------------------------------
    LoopCount VAR BYTE
    CustChar VAR BYTE

    ;----[Program Start]------------------------------------------------------------
    Backlight = 0 ; Turn on LCD Backlight
    ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff
    LoopCount= 0

    ;----[Custom Characters]-(Jumping Jacks)----------------------------------------
    ARRAYWRITE LCD_Buff,[$FE,$40,$00,$04,$0A,$04,$0E,$15,$0A,$11]:LCD_WriteBuff ' #0
    ARRAYWRITE LCD_Buff,[$FE,$48,$00,$04,$0A,$04,$1F,$04,$0A,$0A]:LCD_WriteBuff ' #1
    ARRAYWRITE LCD_Buff,[$FE,$50,$04,$0A,$15,$0E,$04,$0A,$0A,$00]:LCD_WriteBuff ' #2

    ;----[Main Program Loop]--------------------------------------------------------
    Main:
    ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff
    PAUSE 200
    LoopCount = LoopCount + 1

    CustChar = LoopCount//3 ; Jumping Jacks Sequence
    ARRAYWRITE LCD_Buff,[$FE,$C0,CustChar] : LCD_WriteBuff
    GOTO Main

  2. #2
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    I did delete these two lines

    ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff

    ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff

    and Change this line

    ARRAYWRITE LCD_Buff,[$FE,$C0,CustChar] : LCD_WriteBuff ' $C0 was $9D

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    16F629A ?
    might you mean 12f629 ?

    if so you need to set the " lcd " pins to digital
    Warning I'm not a teacher

  4. #4
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Sorry, I should have said 16F628A. I did set my pins as digital? I want to display data from my program but that seems far away at this point?? I cut the program down to the below lines and I get a custom character and a blinking cursor the backlight stays on. I guess that is progress ?

    Thank You!

    ;----[16f628A Hardware Configuration]-------------------------------------------
    #config
    __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_ON & _BODEN_OFF
    #endconfig


    SDA var porta.7
    SCL var porta.6
    ;----[Initialize Hardware]------------------------------------------------------
    CMCON = 7 'CHANGES PORTA TO DIGITAL
    ;----[Setup LCD using PCF8574 Port Expander]------------------------------------
    LCD_Addr CON $7E
    INCLUDE "LCD_PCF8574.pbp" ; Include LCD module for PCF8574

    ARRAYWRITE LCD_Buff,[$FE,$50,$04,$0A,$15,$0E,$04,$0A,$0A,$00]:LCD_WriteBuff ' #2


    Main:

    GOTO Main

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    there is more info here . note the slightly differing versions of the include
    INCLUDE "LCD_PCF8574.pbp" ; Include LCD module for PCF8574
    INCLUDE "LCD_PCF8574a.pbp" ; Include LCD module for PCF8574

    http://support.melabs.com/threads/10...hlight=PCF8574
    http://support.melabs.com/threads/10...hlight=PCF8574
    ps
    LCD_Addr CON $7E is way different to addr used in above threads
    Warning I'm not a teacher

  6. #6
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Richard thank you for your help.

    I have read most of the threads but will read them again. I will find and download both version of the include. On Arduino this is the Initialization for my display the 3F turns into 7E when you shift the bits one to the left.

    "LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)"

    I have used serial lcd displays in the past with no issues. So far I am not a fan of this i2c version. I think someone is missing a market for easy to use i2c displays?

    Thanks again!
    Last edited by n0yox; - 27th February 2017 at 01:50.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    "LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)"

    interpreted as [( 7bit_addr, EN, RW, RS, D4, D5, D6, D7, Backlight, POLARITY) ]

    the PCF8574 datasheet indicates the 7bit addr range is 0x20--0x27

    0x3f is not valid afaik.


    default with a0:2 open = 7bit_addr of 0x27 , pbp addr would be $4e
    Last edited by richard; - 27th February 2017 at 02:38.
    Warning I'm not a teacher

Similar Threads

  1. Another Arduino clone that uses a PIC
    By dhouston in forum PBP & Amicus18
    Replies: 0
    Last Post: - 7th March 2012, 19:14
  2. Arduino ?
    By Michael in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th September 2011, 19:50
  3. How do I operate an Arduino I2C LCD
    By menta in forum General
    Replies: 8
    Last Post: - 13th July 2011, 02:28
  4. Arduino
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st July 2011, 19:11
  5. ARDUINO? -- what is it?
    By Michael in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th August 2009, 00:19

Members who have read this thread : 4

You do not have permission to view the list of names.

Posting Permissions

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