Subversion Repositories group.electronics

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 pfowler 1
Wire.begin
2
_displayfunction = LCD_4BITMODE | LCD_2LINE | LCD_5x8DOTS;
3
	0x08	=  0x00 | 0x08 | 0x00
4
 
5
_backlightval = LCD_BACKLIGHT
6
expanderWrite(LCD_BACKLIGHT)
7
 
8
 
9
 
10
write4bits(0x30) //4500
11
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
12
write4bits(0x30) //4500
13
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
14
write4bits(0x30) //4500
15
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
16
 
17
write4bits(0x20)
18
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]
19
 
20
command(LCD_FUNCTIONSET | _displayfunction) // 0x28
21
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]
22
 : [0x27 0x80] [0x27 0x84] [0x27 0x80]
23
 
24
_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF
25
	0x04	= 0x04 | 0x00 | 0x00
26
 
27
command(LCD_DISPLAYCONTROL | _displaycontrol) // 0x0c
28
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
29
 : [0x27 0xc0] [0x27 0xc4] [0x27 0xc0]
30
 
31
command(LCD_CLEARDISPLAY) //2000  0x01
32
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
33
 : [0x27 0x10] [0x27 0x14] [0x27 0x10]
34
 
35
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT
36
	0x03	= 0x02 | 0x01
37
command(LCD_ENTRYMODESET | _displaymode)
38
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
39
 : [0x27 0x30] [0x27 0x34] [0x27 0x30]
40
 
41
command(LCD_RETURNHOME) //2000 0x02
42
 : [0x27 0x00] [0x27 0x04] [0x27 0x00]
43
 : [0x27 0x20] [0x27 0x24] [0x27 0x20]
44
 
45
send(A) 0x30, mode 0x01
46
 : [0x27 0x31] [0x27 0x35] [0x27 0x31]
47
 : [0x27 0x01] [0x27 0x05] [0x27 0x01]
48
 
49
 
50
 
51
******
52
 
53
command = send($1, 0)
54
 
55
expanderWrite = (Wire.beginTrans(addr), Wire.write((int)data | LCD_BACKLIGHT), Wite.endTrans)
56
 
57
write4bits = (expanderWrite($1), pulse())
58
 
59
send = (write4bits(highNib), write4bits(lowNib)
60
 
61
pulse = (exanderWrite($1 | En), enpanderWrite($1 | ~1)