Subversion Repositories group.electronics

Rev

Rev 41 | Blame | Compare with Previous | Last modification | View Log | RSS feed

Wire.begin
_displayfunction = LCD_4BITMODE | LCD_2LINE | LCD_5x8DOTS;
        0x08    =  0x00 | 0x08 | 0x00

_backlightval = LCD_BACKLIGHT
expanderWrite(LCD_BACKLIGHT)



write4bits(0x30) //4500
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
// : [0x27 0x38] [0x27 0x3c] [0x27 0x38]  //With back light

 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
write4bits(0x30) //4500
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
write4bits(0x30) //4500
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]

write4bits(0x20)
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]

command(LCD_FUNCTIONSET | _displayfunction) // 0x28
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]
 : [0x27 0x80] [0x27 0x84] [0x27 0x80]

_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF
        0x04    = 0x04 | 0x00 | 0x00

command(LCD_DISPLAYCONTROL | _displaycontrol) // 0x0c
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
 : [0x27 0xc0] [0x27 0xc4] [0x27 0xc0]

command(LCD_CLEARDISPLAY) //2000  0x01
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
 : [0x27 0x10] [0x27 0x14] [0x27 0x10]

_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT
        0x03    = 0x02 | 0x01
command(LCD_ENTRYMODESET | _displaymode)
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]

command(LCD_RETURNHOME) //2000 0x02
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]

send(A) 0x30, mode 0x01
 : [0x27 0x31] [0x27 0x35] [0x27 0x31]
 : [0x27 0x01] [0x27 0x05] [0x27 0x01]



******

command = send($1, 0)

expanderWrite = (Wire.beginTrans(addr), Wire.write((int)data | LCD_BACKLIGHT), Wite.endTrans)

write4bits = (expanderWrite($1), pulse())

send = (write4bits(highNib), write4bits(lowNib)

pulse = (exanderWrite($1 | En), enpanderWrite($1 | ~1)