Interfacing with Arduino I2C LCD


Closed Thread
Results 1 to 40 of 48

Hybrid View

  1. #1
    Join Date
    Jun 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    The PIC numbering system was getting me confused so I spoke to an engineer at Microchip and this is what I was told...

    The 12 in the 12F629 means it is an 8 pin chip. (I didn't ask why 12 means 8 or why they just didn't just call it an 8Fxxx)

    The 6 after the F means that it has a 14 bit memory core, since anything other (? # > 5) has a 14 bit memory core.

    A 12F5xx chip would be an 8 pin chip with a 12 bit memory core...

    So it does not seem to a 12-bit core problem but rather an overall memory problem.

    The 12F629 has 1k x 14 memory (there's that 14 bit core again), where as
    the 12F1822 has 2K 14 memory.

    I ordered some 12F1822s to see if I can get Darrel's program working.

  2. #2
    Join Date
    Jun 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Here is the thread in which I believe Darrel was using a 12F1822.

    Post #3

    http://support.melabs.com/threads/98...F8574-20x4-LCD

  3. #3
    Join Date
    Jun 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Hmmm, unfortunately, I just figured out that my Silver version of PBP3.0 doesn't support the 12F1822...

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


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    a pic12f1xxx is an enhanced midrange device . they have twice the stack capacity of a 12f6xx device , apart from more memory etc ....

  5. #5
    Join Date
    Jun 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Thanks to everyone that helped out.

    I have gotten a modified version of Darrel's code to run on a 12F683 which has 2K of memory.

    I am using an LCD 1602 and I don't see any Jumping Jacks.

    Code:
    ; Filename    : 632-I2C-LCD for 12F683.pbp
    ; Author      : Darrel Taylor 
    ; Created     : Mon Feb 24 2014
    ;             : May 27, 2015 adapted for the 12F683 
    ; Processor   : PIC12F683
    ; Compiler    : PicBasic Pro 3.0.7.x or higher
    ; Description : Uses PCF8574 Port expander to interface with HD44780 LCD
    ;
    
    ;----[Oscillator Setup]---------------------------------------------------------
    define OSC 20 
    define I2C_SLOW 1
    
    ;----[Aliases]------------------------------------------------------------------
    SDA         VAR GPIO.0       ; I2C Data pin
    SCL         VAR GPIO.1       ; I2C Clock Pin
    
    ;----[Initialize Hardware]------------------------------------------------------
    ANSEL = 0             ; Make Analog inputs digital
    
    ';----[Setup LCD using PCF8574 Port Expander]------------------------------------
    LCD_Addr    CON $40           ; A0, A1, A2 grounded
    true        con 1
    false       con 0
    INCLUDE "LCD_PCF8574.pbp"     ;  Init LCD using I2C and PCF8574
    
    ;----[Variables]----------------------------------------------------------------
    LoopCount   VAR BYTE
    CustChar    VAR BYTE
    
    ;----[Program Start]------------------------------------------------------------
    Backlight = 0                 ; Turn on LCD Backlight
    LoopCount     = 0
    ARRAYWRITE LCD_Buff,["   LCD PCF8574"] : LCD_WriteBuff
    
    ;----[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,$9D,CustChar] : LCD_WriteBuff
    GOTO Main

  6. #6
    Join Date
    Jun 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Interfacing with Arduino I2C LCD

    Commented out the lines...

    ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff

    and

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

    Changed the $9D to a $C0 in

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

    and now the little guy is doing Jumping Jacks in the lower left hand corner.

    Thanks again!

  7. #7
    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

  8. #8
    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

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