I2C LCD


Closed Thread
Results 1 to 40 of 47

Thread: I2C LCD

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    To inilalize this display wyou need to write something like this
    Code:
    high RESET
    pause 10
    low RESET
    pause 10
    high RESET
    
    I2CWRITE datapin, clockpin,$7C[$80,$57,$80,$6C,$80,$01,$80,$02]
    before you can write to the display
    Code:
    I2CWRITE datapin, clockpin,$7C[$80,$80,$40,$48,$45,$$4C,$4c,$4F]  'HELLO
    I do not have a display to test so not sure if this will work, but this is what I would start with, I took the code from the data sheet.

    Dave

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    You might want to put a resistor on RESET pin, at least 1K.

    Robert

  3. #3
    Join Date
    Jan 2014
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    Quote Originally Posted by DaveC3 View Post
    To inilalize this display wyou need to write something like this
    Code:
    high RESET
    pause 10
    low RESET
    pause 10
    high RESET
    
    I2CWRITE datapin, clockpin,$7C[$80,$57,$80,$6C,$80,$01,$80,$02]
    before you can write to the display
    Code:
    I2CWRITE datapin, clockpin,$7C[$80,$80,$40,$48,$45,$$4C,$4c,$4F]  'HELLO
    I do not have a display to test so not sure if this will work, but this is what I would start with, I took the code from the data sheet.

    Dave
    Thx Dave, I tried but nothing!
    I tried a code for 7036i controller, with V0 connected to Vdd , but I feel that somewhere I'm wrong in DEFINE LCD .
    I know that your help eat a lot of time, but if somebody have a free time to read in datasheet and help me, I'll appreciate!
    Datasheet 7036i : http://www.datasheetarchive.com/dlma...DSA-621251.pdf

    Code :

    Code:
    'PIC 16F1824
    
    #CONFIG
            __CONFIG _CONFIG1, _FCMEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_ON & _IESO_OFF & _BOREN_OFF & _PWRTE_OFF
            __CONFIG _CONFIG2, _PLLEN_OFF & _STVREN_OFF & _LVP_OFF
    #ENDCONFIG
    
    OSCCON = %01101010   'sets the internal oscillator to 4Mhz
          
    TRISA  = %00000000  
    TRISC  = %00000000  
    ANSELA = %00000000  
    ANSELC = %00000000  
    
    OPTION_REG.7 = 0
    WPUA = %00000000
    WPUC = %00000011
    
    PORTA = 0  
    PORTC = 0
      
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    RS    var PORTC.2 
    symbol mode = $7C
    
    pause 100
    RS = 0
    'OPF1 = 0 ; OPF2 = 0 . => BON=0, FON=1. => Vout=Vin (pag50 datasheet)
    
    '=============Initializing by Instruction==========pag 39 datasheet
    
    'CLEAR LCD --------------pag 28 datasheet
    I2CWRITE sda, scl,mode,[$01]
    pause 10
     
    'ENTRY MODE SET----------
     I2CWRITE sda, scl,mode,[$07] 'cursor/blink moves to right and DDRAM address is increased by 1.
     pause 10
     
    'FUNCTION SET------------pag 30 datasheet
    I2CWRITE sda, scl,mode,[$38] ' 8 bit, 2 lines, font normal, instruction table 0
    pause 10
    
    'CURSOR DISPLAY------------pag 29 datasheet
    I2CWRITE sda, scl,mode,[$14]
    pause 10
    
    'INTERNAL OSC------------pag 35 datasheet
    I2CWRITE sda, scl,mode,[$14] ' 1/5 BIAS , 130Hz/5v
    pause 10
    
    'CONTRAST SET------------pag 37 datasheet
    I2CWRITE sda, scl,mode,[$7F]
    pause 10
    
    'POWER/ICON/CONTRAST------pag 36 datasheet
    I2CWRITE sda, scl,mode,[$5B] 'ICON=ON, BON = OFF , contrast $03
    pause 10
    
    'FOLLOWER CONTROL-------pag 37 datasheet
    I2CWRITE sda, scl,mode,[$6F] 'FON=1 ..set is correct ??
    pause 10
    
    'DISPLAY ON------------- pag 29 datasheet
    I2CWRITE sda, scl,mode,[$0E] 'display ON, cursor ON, blink OFF
    pause 10
    
    RS = 1
    pause 500
    
    I2CWRITE SDA,SCL,mode,["HELLO"] 'print on the first line

  4. #4
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    Try this, initalization based on an arduino sketch
    Code:
    'PIC 16F1824
    
    #CONFIG
            __CONFIG _CONFIG1, _FCMEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_ON & _IESO_OFF & _BOREN_OFF & _PWRTE_OFF
            __CONFIG _CONFIG2, _PLLEN_OFF & _STVREN_OFF & _LVP_OFF
    #ENDCONFIG
    
    OSCCON = %01101010   'sets the internal oscillator to 4Mhz
          
    TRISA  = %00000000  
    TRISC  = %00000000  
    ANSELA = %00000000  
    ANSELC = %00000000  
    
    OPTION_REG.7 = 0
    WPUA = %00000000
    WPUC = %00000011
    
    PORTA = 0  
    PORTC = 0
      
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    RS    var PORTC.2 
    symbol mode = $7C
    
    pause 100
    RS = 0
    'OPF1 = 0 ; OPF2 = 0 . => BON=0, FON=1. => Vout=Vin (pag50 datasheet)
    
    '=============Initializing by Instruction==========pag 39 datasheet
    
     
    I2CWRITE PORTC.1, PORTC.0,$7C,[$00] 'send command to display
     
    'FUNCTION SET 0 and 1 ------------pag 30 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$38] ' Function set - 8 bit, 2 line display 5x8, inst table 0
    pause 10
    
    I2CWRITE PORTC.1, PORTC.0,$7C,[$39] ' Function set - 8 bit, 2 line display 5x8, inst table 1
    pause 10
    
    
    
    'INTERNAL OSC------------pag 35 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$14] ' 1/5 BIAS , 130Hz/5v
    
    
    'CONTRAST SET------------pag 37 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$73]
    
    
    'POWER/ICON/CONTRAST------pag 36 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$5E] 'ICON=ON, BON = OFF , contrast $03
    
    
    'FOLLOWER CONTROL-------pag 37 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$6D] 'FON=1 ..set is correct ??
    pause 10
    
    'DISPLAY ON------------- pag 29 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$0C] 'display ON, cursor ON, blink OFF
    
    
    
    'CLEAR LCD --------------pag 28 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$01]
    
    
    'ENTRY MODE SET----------
     I2CWRITE PORTC.1, PORTC.0,$7C,[$06] 'cursor/blink moves to right and DDRAM address is increased by 1.
    
    
    RS = 1
    pause 500
    
    I2CWRITE PORTC.1,PORTC.0,$7C,["HELLO"] 'print on the first line [ I am not sure this line will work]
    Can you include a high res picture of your display?

  5. #5
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    try this
    Code:
    'PIC 16F1824
    
    #CONFIG
            __CONFIG _CONFIG1, _FCMEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_ON & _IESO_OFF & _BOREN_OFF & _PWRTE_OFF
            __CONFIG _CONFIG2, _PLLEN_OFF & _STVREN_OFF & _LVP_OFF
    #ENDCONFIG
    
    OSCCON = %01101010   'sets the internal oscillator to 4Mhz
          
    TRISA  = %00000000  
    TRISC  = %00000000  
    ANSELA = %00000000  
    ANSELC = %00000000  
    
    OPTION_REG.7 = 0
    WPUA = %00000000
    WPUC = %00000011
    
    PORTA = 0  
    PORTC = 0
      
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    RS    var PORTC.2 
    symbol mode = $7C
    
    pause 100
    RS = 0
    'OPF1 = 0 ; OPF2 = 0 . => BON=0, FON=1. => Vout=Vin (pag50 datasheet)
    
    '=============Initializing by Instruction==========pag 39 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$78] 'slave
     
    I2CWRITE PORTC.1, PORTC.0,$7C,[$00] 'send command to display
     
    'FUNCTION SET 0 and 1 ------------pag 30 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$38] ' Function set - 8 bit, 2 line display 5x8, inst table 0
    pause 10
    
    I2CWRITE PORTC.1, PORTC.0,$7C,[$39] ' Function set - 8 bit, 2 line display 5x8, inst table 1
    pause 10
    
    
    
    'INTERNAL OSC------------pag 35 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$14] ' 1/5 BIAS , 130Hz/5v
    
    
    'CONTRAST SET------------pag 37 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$73]
    
    
    'POWER/ICON/CONTRAST------pag 36 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$5E] 'ICON=ON, BON = OFF , contrast $03
    
    
    'FOLLOWER CONTROL-------pag 37 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$6D] 'FON=1 ..set is correct ??
    pause 10
    
    'DISPLAY ON------------- pag 29 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$0C] 'display ON, cursor ON, blink OFF
    
    
    
    'CLEAR LCD --------------pag 28 datasheet
    I2CWRITE PORTC.1, PORTC.0,$7C,[$01]
    
    
    'ENTRY MODE SET----------
     I2CWRITE PORTC.1, PORTC.0,$7C,[$06] 'cursor/blink moves to right and DDRAM address is increased by 1.
    
    
    RS = 1
    pause 500
    I2CWRITE PORTC.1, PORTC.0,$7C,[$78] 'slave
     
    I2CWRITE PORTC.1, PORTC.0,$7C,[$40] 'Write to display RAM
    I2CWRITE PORTC.1,PORTC.0,$7C,["HELLO"] 'print on the first line [ I am not sure this line will work]
    end

  6. #6
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: I2C LCD

    or try this,
    Code:
     #CONFIG
            __CONFIG _CONFIG1, _FCMEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_ON & _IESO_OFF & _BOREN_OFF & _PWRTE_OFF
            __CONFIG _CONFIG2, _PLLEN_OFF & _STVREN_OFF & _LVP_OFF
    #ENDCONFIG
    OSCCON = %01101010   'sets the internal oscillator to 4Mhz
          
    TRISA  = %00000000  
    TRISC  = %00000000  
    ANSELA = %00000000  
    ANSELC = %00000000  
    
    OPTION_REG.7 = 0
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    Reset    var PORTC.2     'could tie reset pin to   vdd through 10K resistor
    
    
    pause 100
    HIGH Reset
    'OPF1 = 0 
    goto StartProgram
    '********************************************************************************
    '=============Initializing LCD==========
    ST7036Init:
    
    
     
    'FUNCTION SET 0 and 1 ------------pag 30 datasheet
    
    I2CWRITE PORTC.1, PORTC.0,$78,[$00,$38] ' Function set - 8 bit, 2 line display 5x8, inst table 0
    pause 10
    
    I2CWRITE PORTC.1, PORTC.0,$78,[$00,$39] ' Function set - 8 bit, 2 line display 5x8, inst table 1
    pause 10
    
    I2CWRITE PORTC.1, PORTC.0,$78,[$00,$14,$73,$5E,$6D,$0C,$01,$06] ' 
    
    
    
    Return
    '********************************************************************************
    
    
    
    startProgram:
    gosub  ST7036Init
    I2CWRITE PORTC.1, PORTC.0,$78,[$40,$48,$65,$6c,$6c,$6f] ' Hello
    
    IdleLoop:
          ' could blink an led here
    goto Idleloop

Similar Threads

  1. I2C lcd ( arduino ) with PICBASIC, help
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 92
    Last Post: - 10th September 2014, 18:00
  2. I2C variable to LCD
    By pointjohn in forum Serial
    Replies: 7
    Last Post: - 19th October 2011, 08:53
  3. I2C to LCD display
    By Ron Marcus in forum Serial
    Replies: 3
    Last Post: - 29th December 2007, 14:53
  4. Need cheap i2c LCD for 16F877a
    By CodeShredder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th December 2006, 01:25

Members who have read this thread : 2

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