I2C LCD


Closed Thread
Results 1 to 40 of 47

Thread: I2C LCD

Hybrid View

  1. #1
    Join Date
    Jan 2014
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: 16LF1824 strange problem

    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
    WPUA = %00000000
    WPUC = %00000011
    
    PORTA = 0  
    PORTC = 0
      
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    RESET var PORTC.2 ; IT'S REQUIRED?
    
    cbyte var byte 'CONTROL BYTE FOR DATA
    I2C   var byte 'CONTROL BYTE FOR CONTROL CODES
    
    cbyte = 0 'USE TO send a command
    I2C   = $7C 'ADDRESS FROM MANUAL ??
    
    main:
    
    I2CWRITE SDA,SCL,I2C,cbyte,[$25] 'contrast
    PAUSE 1
    I2CWRITE SDA,SCL,I2C,cbyte,["HELLO"] 'print on the first line
    pause 3000
    
    goto main
    end

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


    Did you find this post helpful? Yes | No

    Default Re: 16LF1824 strange problem

    It might be working but the lcd might not have high enough contrast.

    Usually, V0 is not VDD.

    Try a 20K variable resistor, V0 to center pin, VDD to one side, GND to other side.

    Now turn resistor and look at LCD for changes.

    Edit: also increase pause between writes to lcd in case it needs more time. Try PAUSE500 to test.

    Robert
    Last edited by Demon; - 26th December 2014 at 21:36.

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


    Did you find this post helpful? Yes | No

    Default Re: 16LF1824 strange problem

    Quote Originally Posted by Demon View Post
    ...
    Try a 20K variable resistor, V0 to center pin, VDD to one side, GND to other side.
    ...
    You still need VDD to pin 4.

    Robert

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 : 6

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