Difference between revisions of "Grove LCD RGB Backlight 16x2"
From Teknologisk videncenter
m |
m |
||
Line 1: | Line 1: | ||
[[Image:Grove - LCD RGB Backlight.png|thumb|200px|right|LCD with RGB Backlight]] | [[Image:Grove - LCD RGB Backlight.png|thumb|200px|right|LCD with RGB Backlight]] | ||
+ | =Eksempel på funktionalitet= | ||
+ | <source lang=bash> | ||
+ | #!/bin/bash | ||
+ | # Hex codes found with | ||
+ | # echo Viborg | od -x --endian=big | ||
+ | # 0000000 5669 626f 7267 0a00 | ||
+ | |||
+ | # i2cset -y <i2cBUS> <i2cADDRESS> <Control Byte> <Data byte> | ||
+ | # Control byte bits Co RS 0 0 0 0 0 0 ( 0x80 = Co, 0x40 = RS, 0xc0 = Co and RS) | ||
+ | # Co: 0 = Last Control Byte - 1 = Another Control Byte follows | ||
+ | # RS: 0 = Following data byte is a command - 1 = following data byte is data | ||
+ | #Function set 0010 1000 // 2 line mode and 5x8 | ||
+ | i2cset -y 2 0x3e 0x00 0x28 | ||
+ | #Display on/off control 0000 1110 // Diplay on cursor on blink off | ||
+ | i2cset -y 2 0x3e 0x00 0x0D | ||
+ | #Display clear | ||
+ | i2cset -y 2 0x3e 0x00 0x01 | ||
+ | #Entry mode set 0000 0110 | ||
+ | i2cset -y 2 0x3e 0x00 0x06 | ||
+ | #i2cset -y 2 0x3e 0x20 0x06 | ||
+ | #i2cset -y 2 0x3e 0x8 0x06 | ||
+ | i2cset -y 2 0x3e 0x00 0x02 | ||
+ | # 1xxx xxxx = set DDRAM adress = 1000 0000 to 1011 1111 | ||
+ | # first line (1000 0000 to 1000 1111 possible on 16 characters line) = 0x80 to 0x8f | ||
+ | # second line (1100 0000 to 1100 1111 possible on 16 characters line) = 0xC0 to 0xCf | ||
+ | i2cset -y 2 0x3e 0x00 0x84 # 5th character on line 1 | ||
+ | #Display Mercantec | ||
+ | i2cset -y 2 0x3e 0x40 0x4d | ||
+ | i2cset -y 2 0x3e 0x40 0x65 | ||
+ | i2cset -y 2 0x3e 0x40 0x72 | ||
+ | i2cset -y 2 0x3e 0x40 0x63 | ||
+ | i2cset -y 2 0x3e 0x40 0x61 | ||
+ | i2cset -y 2 0x3e 0x40 0x6e | ||
+ | i2cset -y 2 0x3e 0x40 0x74 | ||
+ | i2cset -y 2 0x3e 0x40 0x65 | ||
+ | i2cset -y 2 0x3e 0x40 0x63 | ||
+ | #Display Viborg in middle of second line | ||
+ | i2cset -y 2 0x3e 0x00 0xC5 # 5th character on line 2 | ||
+ | i2cset -y 2 0x3e 0x40 0x56 | ||
+ | i2cset -y 2 0x3e 0x40 0x69 | ||
+ | i2cset -y 2 0x3e 0x40 0x62 | ||
+ | i2cset -y 2 0x3e 0x40 0x6f | ||
+ | i2cset -y 2 0x3e 0x40 0x72 | ||
+ | i2cset -y 2 0x3e 0x40 0x67 | ||
+ | </source> | ||
=Links= | =Links= | ||
*[https://wiki.seeedstudio.com/Grove-LCD_RGB_Backlight/ Seeed studio Grove LCD Backlight homepage] | *[https://wiki.seeedstudio.com/Grove-LCD_RGB_Backlight/ Seeed studio Grove LCD Backlight homepage] |
Revision as of 08:18, 8 April 2022
Eksempel på funktionalitet
#!/bin/bash
# Hex codes found with
# echo Viborg | od -x --endian=big
# 0000000 5669 626f 7267 0a00
# i2cset -y <i2cBUS> <i2cADDRESS> <Control Byte> <Data byte>
# Control byte bits Co RS 0 0 0 0 0 0 ( 0x80 = Co, 0x40 = RS, 0xc0 = Co and RS)
# Co: 0 = Last Control Byte - 1 = Another Control Byte follows
# RS: 0 = Following data byte is a command - 1 = following data byte is data
#Function set 0010 1000 // 2 line mode and 5x8
i2cset -y 2 0x3e 0x00 0x28
#Display on/off control 0000 1110 // Diplay on cursor on blink off
i2cset -y 2 0x3e 0x00 0x0D
#Display clear
i2cset -y 2 0x3e 0x00 0x01
#Entry mode set 0000 0110
i2cset -y 2 0x3e 0x00 0x06
#i2cset -y 2 0x3e 0x20 0x06
#i2cset -y 2 0x3e 0x8 0x06
i2cset -y 2 0x3e 0x00 0x02
# 1xxx xxxx = set DDRAM adress = 1000 0000 to 1011 1111
# first line (1000 0000 to 1000 1111 possible on 16 characters line) = 0x80 to 0x8f
# second line (1100 0000 to 1100 1111 possible on 16 characters line) = 0xC0 to 0xCf
i2cset -y 2 0x3e 0x00 0x84 # 5th character on line 1
#Display Mercantec
i2cset -y 2 0x3e 0x40 0x4d
i2cset -y 2 0x3e 0x40 0x65
i2cset -y 2 0x3e 0x40 0x72
i2cset -y 2 0x3e 0x40 0x63
i2cset -y 2 0x3e 0x40 0x61
i2cset -y 2 0x3e 0x40 0x6e
i2cset -y 2 0x3e 0x40 0x74
i2cset -y 2 0x3e 0x40 0x65
i2cset -y 2 0x3e 0x40 0x63
#Display Viborg in middle of second line
i2cset -y 2 0x3e 0x00 0xC5 # 5th character on line 2
i2cset -y 2 0x3e 0x40 0x56
i2cset -y 2 0x3e 0x40 0x69
i2cset -y 2 0x3e 0x40 0x62
i2cset -y 2 0x3e 0x40 0x6f
i2cset -y 2 0x3e 0x40 0x72
i2cset -y 2 0x3e 0x40 0x67
Links
- Seeed studio Grove LCD Backlight homepage
- NXP PCA9632 datasheet (RGB Backlight control chip)
- AiP31068 datasheet (LCD Display control chip)