Welcome! Log In Create A New Profile

Advanced

PO18 I2C 16x2 LCD Bypic code

Posted by TCKsteve 
PO18 I2C 16x2 LCD Bypic code
November 29, 2013 01:13PM
Is there any example code for example to print "hello" to the LCD display using the I2C PO18 LCD controller?
Re: PO18 I2C 16x2 LCD Bypic code
November 29, 2013 04:41PM
The following code should do it:
// *****************************************************************************
// sends a string to the LCD
// *****************************************************************************
function lcd_text(s$[30])
dim j
    i2c_start(I2CADR)
    i2c_putc(3) // data command
    for j = 0 to strlen(s$)-1 
        i2c_putc(asc(s$,j))
    next
    i2c_putc(13) // *** must terminate data send with 13 ***
    i2c_stop()

// *****************************************************************************
// Print hello to lcd screen
// *****************************************************************************
function hello()
    i2c_open(100000) // initialise
    wait(100)
    lcd_text("Hello")
endf



Edited 1 time(s). Last edit at 11/29/2013 04:59PM by jimeer.
Re: PO18 I2C 16x2 LCD Bypic code
December 29, 2013 03:16PM
Many thanks - I can get the i2c address ok, adjust brightness but the unit does not display characters:
a faulty LCD?

function lcd_text(s$[30])
dim j
i2c_start(112)
i2c_putc(3) // data command
for j = 0 to strlen(s$)-1
i2c_putc(asc(s$,j))
next
i2c_putc(13) // *** must terminate data send with 13 ***
i2c_stop()
endf

function hi()
dim x
x = i2c_find(0x30,0xf0)
print "\ni2c address",hex$(x)

i2c_open(100000) // initialise
wait(100)
i2c_start(x)
i2c_putc(1)
i2c_putc(5) //brightness
i2c_putc(0)
i2c_putc(0)
i2c_putc(13)
i2c_stop()

wait(100)
i2c_start(x)
i2c_putc(3)
i2c_putc(102) //f
i2c_putc(114) //r
i2c_putc(101) //e
i2c_putc(100) //d
i2c_putc(13)
i2c_stop()

// lcd_text("Hello")

endf
Re: PO18 I2C 16x2 LCD Bypic code
December 29, 2013 04:04PM
The problem may be 5v vs 3.3 volt supply? i2c coms is ok when using 3.3 volts but when 5 volts is connected to P018 and LCD there is no coms.
Re: PO18 I2C 16x2 LCD Bypic code
December 29, 2013 06:17PM
RB8 and RB9 are 5 v tolerant...... LCD needs 5 volts and 4k7 resistors to pull up to 5 v
Re: PO18 I2C 16x2 LCD Bypic code
December 31, 2013 06:48AM
The question I keep getting asked is that the display does not display any characters but the communication is working because the back light or some other function can be changed. This is nearly always down to the supply voltage that must be greater then 4.8 Volts.

see This post for more details.
F1p
Re: PO18 I2C 16x2 LCD Bypic code
January 15, 2014 08:12PM
On mine there seems to be a huge voltage drop, tested a 5V 2A phone charger, connected to the arduino - providing 6.12V
When plugging in the LCD, drop to 4.5V, which isn't enough for the characters.

Currently having a problem with just random symbols appearing on the display.
Re: PO18 I2C 16x2 LCD Bypic code
January 16, 2014 08:10AM
You are working on the assumption that the power supply is providing 5V at 2A. The fact that is gives 6V under no load should ring alarm bells. For supplying this type of equipment you need a DC regulated power supply. The one you have is either faulty or not suitable.

Supplying any equipment rated at 5V could lead to damage if supplied with a higher voltage although it is quite likely that 6V in the short term will not do much harm. To be more focused on where the fault may be; measure the actual current that the display is taking. Or better still try with another power supply but make sure that it puts out 5V (between 4.9 and 5.3) before connecting up.
Sorry, you do not have permission to post/reply in this forum.