I2C LCD - Page 2


+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 41 to 47 of 47

Thread: I2C LCD

  1. #41
    Join Date
    Jan 2014
    Posts
    83

    Default Re: I2C LCD

    Nothing on LCD: I2CWRITE SDA, SCL,com,$40, x
    In ST7036 manual I not found how I can display a decimal number.

  2. #42
    Join Date
    May 2013
    Location
    australia
    Posts
    1,922

    Default Re: I2C LCD

    I2CWRITE SDA, SCL,com,$40,"hello"
    looks like incorrect syntax , should be like this
    Code:
    I2CWRITE SDA, SCL,com,[$40,"hello"]
    to display x (assume pbp3)

    Code:
    buff var byte[16]
    
    ARRAYWRITE buff,[dec3 x]
    I2CWRITE SDA, SCL,com,[$40,str buff"]
    [/CODE]

  3. #43
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Re: I2C LCD

    Now that I think about it you probably will need to include a "Modifer" before your variable.

    Otherwise your LCD display may think the number is some sort of control character or it may be a non displayable character.


    from the PBP manual...


    An assortment of string-formatting modifiers is available for use within the item list
    of this command. These modifiers can be used to format string output that includes
    numeric values converted from variables:
    Output Modifiers for Formatting Strings
    Modifier Operation
    {I}{S}DEC{1..10} Send decimal digits
    {I}{S}BIN{1..32} Send binary digits
    {I}{S}HEX{1..8} Send hexadecimal digits
    REP char\count Send character c repeated n
    times
    STR ArrayVar{\count} Send string of n characters
    See section 2.11 for details on string-formatting modifiers.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  4. #44
    Join Date
    Jan 2014
    Posts
    83

    Default Re: I2C LCD

    Now display the x value on LCD , like "hello 012" .

    In main loop, the text is scrolling from right to left on 2 lines.

    Code:
    SCL   VAR PORTC.0
    SDA   var PORTC.1
    Reset var PORTC.2    
    x     var byte   :x=12
    com   con $78
    buff  var byte[16]
    pause 100
    HIGH Reset
    
    goto StartProgram
    '********************************************************************************
    '=============Initializing LCD==========
    ST7036Init:
    I2CWRITE SDA,SCL,com,[$00,$38]'function set
    pause 1
    I2CWRITE SDA,SCL,com,[$00,$39]'function set
    pause 1
    I2CWRITE SDA,SCL,com,[$00,$14]'internal OSC
    pause 1
    I2CWRITE SDA,SCL,com,[$00,$6A]'follower control
    pause 1
    I2CWRITE SDA,SCL,com,[$00,$0C]'display on/off
    pause 1
    here:
    I2CWRITE SDA,SCL,com,[$00,$01]'clear display
    pause 1
    I2CWRITE SDA,SCL,com,[$00,$06]'entry mode set
    pause 1
    Return
    '********************************************************************************
    startProgram:
    ARRAYWRITE buff,[dec3 x]
    
    gosub  ST7036Init
    
    I2CWRITE SDA, SCL,com,[$40,"hello  ",str buff\x]
    
    Main:
    'I2CWRITE SDA, SCL,com,[$40,"hello  ",str buff\x]
    pause 1000
    goto Main
    Thank you very much for your help!

  5. #45
    Join Date
    May 2013
    Location
    australia
    Posts
    1,922

    Default Re: I2C LCD

    I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\x]
    is incorrect



    I2CWRITE SDA, SCL,com,[$40,"hello ",str buff]
    or
    I2CWRITE SDA, SCL,com,[$40,"hello ",str buff\3 ]
    is whats required.


    The "\x" ( length specifier) if used is the number or chr's in the the string {buff in this case } to send (12 {the value of x} is inappropriate), a null terminated string (as created by arraywrite ) needs no length parameter to be specified if you wish to send the entire string

  6. #46
    Join Date
    Jan 2014
    Posts
    83

    Default Re: I2C LCD

    Now I understand arrays variable. Thank you for your patience and explanation!

  7. #47
    zoltanh's Avatar
    zoltanh Guest

    Default Re: I2C LCD

    Hi,

    I am just curious. Did you manage to run LCD with the pinout from MIDAS? I mean the pinout you mentioned at beginning of this thread.

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

Posting Permissions

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