Python driving ST7565 12864 LCD


36 posts   Page 2 of 2   1, 2
by ukgamer » Thu Dec 27, 2012 5:11 pm
We're getting somewhere!

Image

I greatly appreciate your help, but I still have some questions. You can see that I tried displaying the Pi logo (which worked fine) and changing the text shown, but it seems that the display is not being cleared properly as I can still see pixels "left over" from whatever was on the screen before.

The text also seems to be clipped - you can see this on the left side of the screen where the first few pixels of each character are cut off.

I suspect the pixels in the bottom right of the screen are also due to this screen clearing issue.
Posts: 11
Joined: Fri Nov 16, 2012 5:50 pm
Location: Coventry, England
by buxiaoyang » Fri Dec 28, 2012 2:20 am
ukgamer wrote:We're getting somewhere!

Image

I greatly appreciate your help, but I still have some questions. You can see that I tried displaying the Pi logo (which worked fine) and changing the text shown, but it seems that the display is not being cleared properly as I can still see pixels "left over" from whatever was on the screen before.

The text also seems to be clipped - you can see this on the left side of the screen where the first few pixels of each character are cut off.

I suspect the pixels in the bottom right of the screen are also due to this screen clearing issue.

Before you changing to the text shown you need to clear up the display RAM, otherwise the old data will still there if you don't overwrite it. You can put a lcd_clear() before changing the show like:
Code: Select all
   lcd_picture(0,0,0)
   time.sleep(5)
   lcd_clear()
   lcd_ascii168_string(0,0,"This is demo of")
   lcd_ascii168_string(0,2,"raspberry pi LCD")
   lcd_ascii168_string(0,4,"0123456789")
   lcd_ascii168_string(0,6,"@ABCDEFG")

For the text clipped issues, do you set the right start column? I mean when i changed my code with start column -1 like:
Code: Select all
   lcd_ascii168_string(-1,0,"Testing the LCD5")
   lcd_ascii168_string(-1,2,"with the Raspberry pi")
   lcd_ascii168_string(-1,4,"0123456789")
   lcd_ascii168_string(-1,6,"@ABCDEF~!?.,")

I got the same clipped with you.
IMG_3015.jpg
IMG_3015.jpg (62.53 KiB) Viewed 1098 times
You can try to set the start column as 0 or 1 to see what happens.

Shawn
Posts: 21
Joined: Wed Dec 05, 2012 1:25 pm
by ukgamer » Fri Dec 28, 2012 5:47 am
Changing the start column to 1 seems to have fixed the clipping issue.

However, the LCD is not clearing. lcd_clear() is called during lcd_init() before I write the text, but I can still see old data being displayed.
Posts: 11
Joined: Fri Nov 16, 2012 5:50 pm
Location: Coventry, England
by buxiaoyang » Fri Dec 28, 2012 7:11 am
ukgamer wrote:Changing the start column to 1 seems to have fixed the clipping issue.

However, the LCD is not clearing. lcd_clear() is called during lcd_init() before I write the text, but I can still see old data being displayed.

Strange problem, lcd_clear() works well in my screen. This function do a simply operation, just put 0x00 to all display RAM. Can you post your code? Let's check if something is wrong in your side.

Shawn
Posts: 21
Joined: Wed Dec 05, 2012 1:25 pm
by ukgamer » Fri Dec 28, 2012 8:34 am
Code: Select all
import RPi.GPIO as GPIO

LCD_CS = 11
LCD_RST = 13
LCD_A0 = 15
LCD_CLK = 12
LCD_SI = 16

def main():
    io_init()
    print GPIO.RPI_REVISION
    lcd_init()
    lcd_ascii168_string(1, 0, "Test")
    lcd_ascii168_string(1, 2, "test 2")
    lcd_ascii168_string(1, 4, "0123456789")
    lcd_ascii168_string(1, 6, "@ABCDEF~!?.,")
    #lcd_picture(0,0,0)

def io_init():
    GPIO.setmode(GPIO.BOARD)
    GPIO.setwarnings(False)
    GPIO.setup(LCD_CS, GPIO.OUT)
    GPIO.setup(LCD_RST, GPIO.OUT)
    GPIO.setup(LCD_A0, GPIO.OUT)
    GPIO.setup(LCD_CLK, GPIO.OUT)
    GPIO.setup(LCD_SI, GPIO.OUT)
   
def lcd_init():
    GPIO.output(LCD_CS, True)
    GPIO.output(LCD_RST, False)
    GPIO.output(LCD_RST, True)
    lcd_transfer_data(0xe2, 0)   #Internal reset
    lcd_transfer_data(0xa3, 0)   #Sets the LCD drive voltage bias ratio
                ##A2: 1/9 bias
                ##A3: 1/7 bias (ST7565V)
    lcd_transfer_data(0xa0, 0)   #Sets the display RAM address SEG output correspondence
                ##A0: normal
                ##A1: reverse
    lcd_transfer_data(0xc8, 0)   #Select COM output scan direction
                ##C0~C7: normal direction
                ##C8~CF: reverse direction
    lcd_transfer_data(0xa4, 0)   #Display all points ON/OFF
                ##A4: normal display
                ##A5: all points ON
    lcd_transfer_data(0xa6, 0)   #Sets the LCD display normal/reverse
                ##A6: normal
                ##A7: reverse
    lcd_transfer_data(0x2F, 0)   #Select internal power supply operating mode
                ##28~2F: Operating mode
    lcd_transfer_data(0x60, 0)   #Display start line set
                ##40~7F Display start address
    lcd_transfer_data(0x22, 0)   #V5 voltage regulator internal resistor ratio set (contrast)
                ##20~27 small~large
    lcd_transfer_data(0x81, 0)   #Electronic volume mode set
                ##81: Set the V5 output voltage
    lcd_transfer_data(0x14, 0)   #Electronic volume register set
                ##00~3F: electronic volume register
    lcd_transfer_data(0xaf, 0)   #Display ON/OFF
                ##AF: ON
                ##AE: OFF
    lcd_clear()

def lcd_picture(xPos, yPos, char):
    for i in range(0, 8):
        lcd_set_page(yPos + i, xPos)
        for j in range(128 * i, 128 * (i + 1)):
            lcd_transfer_data(PICTURE[char][j], 1)

def lcd_ascii168_string(xPos, yPos, string):
    stringLen = len(string)
    for i in range(0, stringLen):
        lcd_ascii168(xPos + i * 8, yPos, ord(string[i]) - 32)

def lcd_ascii168(xPos, yPos, char):
    lcd_set_page(yPos, xPos)
    for i in range(0, 8):
        lcd_transfer_data(ASCII168[char][i], 1)
    lcd_set_page(yPos + 1, xPos)   
    for i in range(8, 16):
        lcd_transfer_data(ASCII168[char][i], 1)

def lcd_clear():
    GPIO.output(LCD_CS, False)
    for i in range(0, 8):           
        lcd_set_page(i, 0)
    for j in range(0, 128):                                           
        lcd_transfer_data(0x00, 1)
    GPIO.output(LCD_CS, True)

def lcd_set_page(page, column):
    lsb = column & 0x0f
    msb = column & 0xf0
    msb = msb >> 4
    msb = msb | 0x10                 
    page = page | 0xb0                               
    lcd_transfer_data(page, 0)
    lcd_transfer_data(msb, 0)
    lcd_transfer_data(lsb, 0)


def lcd_transfer_data(value, SI):
    GPIO.output(LCD_CS, False)
    GPIO.output(LCD_CLK, True)
    if (SI):
        GPIO.output(LCD_A0, True)
    else:
        GPIO.output(LCD_A0, False)
    lcd_byte(value)
    GPIO.output(LCD_CS, True)


def lcd_byte(bits):
    tmp = bits;
    for i in range(0, 8):
        GPIO.output(LCD_CLK, False)
        if (tmp & 0x80):
            GPIO.output(LCD_SI, True)
        else:
            GPIO.output(LCD_SI, False)
        tmp = (tmp << 1)
        GPIO.output(LCD_CLK, True)
     
ASCII168 = (
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#" ",0
    (0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00),#"!",1
    (0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#""",2
    (0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00),#"#",3
    (0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00),#"$",4
    (0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00),#"%",5
    (0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10),#"&",6
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00),#",",7
    (0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00),#"(",8
    (0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00),#")",9
    (0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00),#"*",10
    (0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00),#"+",11
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00),#",",12
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01),#"-",13
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00),#".",14
    (0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00),#"/",15
    (0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00),#"0",16
    (0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"1",17
    (0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00),#"2",18
    (0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00),#"3",19
    (0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00),#"4",20
    (0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00),#"5",21
    (0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00),#"6",22
    (0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00),#"7",23
    (0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00),#"8",24
    (0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00),#"9",25
    (0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00),#":",26
    (0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00),#";",27
    (0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00),#"<",28
    (0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00),#"=",29
    (0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00),#">",30
    (0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00),#"?",31
    (0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00),#"@",32
    (0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20),#"A",33
    (0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00),#"B",34
    (0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00),#"C",35
    (0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00),#"D",36
    (0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00),#"E",37
    (0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00),#"F",38
    (0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00),#"G",39
    (0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20),#"H",40
    (0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"I",41
    (0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00),#"J",42
    (0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00),#"K",43
    (0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00),#"L",44
    (0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00),#"M",45
    (0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00),#"N",46
    (0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00),#"O",47
    (0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00),#"P",48
    (0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00),#"Q",49
    (0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20),#"R",50
    (0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00),#"S",51
    (0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00),#"T",52
    (0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00),#"U",53
    (0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00),#"V",54
    (0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00),#"W",55
    (0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20),#"X",56
    (0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00),#"Y",57
    (0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00),#"Z",58
    (0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00),#"[",59
    (0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00),#"/",60
    (0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00),#"]",61
    (0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#"^",62
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01),#"-",63
    (0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00),#"\",64
    (0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20),#"a",65
    (0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00),#"b",66
    (0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00),#"c",67
    (0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20),#"d",68
    (0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00),#"e",69
    (0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"f",70
    (0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00),#"g",71
    (0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20),#"h",72
    (0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"i",73
    (0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00),#"j",74
    (0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00),#"k",75
    (0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"l",76
    (0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F),#"m",77
    (0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20),#"n",79
    (0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00),#"o",80
    (0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00),#"p",81
    (0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80),#"q",82
    (0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00),#"r",83
    (0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00),#"s",84
    (0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00),#"t",85
    (0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20),#"u",86
    (0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00),#"v",87
    (0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00),#"w",88
    (0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00),#"x",89
    (0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00),#"y",90
    (0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00),#"z",91
    (0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40),#"{",92
    (0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00),#"|",93
    (0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00),#"}",94
    (0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#"~",95
)

PICTURE = (
    (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0xF0,0xF8,0x58,0x1C,0x1C,0x0C,0x0C,0x06,0x86,0x86,0x86,0x0E,
    0x0E,0x06,0x0E,0x1E,0x1C,0x1C,0x0C,0x3C,0x38,0x78,0xF0,0xE0,0xC0,0xC0,0xE0,0x70,
    0x38,0x18,0x1C,0x1C,0x0C,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x86,0x86,0x06,0x04,0x0C,
    0x0C,0x18,0xF8,0xF8,0xF8,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x03,0x0F,0x3F,0x7C,0xF0,0xC0,0xC0,0xC0,0xC0,0x00,0x01,0x01,
    0x03,0x02,0x06,0x04,0x04,0x1C,0xB8,0xF0,0xE0,0x70,0x30,0x1F,0x0F,0x0F,0x3F,0x30,
    0xF0,0xE0,0xB0,0x18,0x08,0x0C,0x04,0x06,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0xC0,
    0xF0,0xF8,0x7F,0x1F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xF3,0x33,0x3F,0x1F,0x1E,0x0E,0x0E,
    0x0C,0x0C,0xEC,0xEC,0xEE,0xBE,0x0F,0x0F,0x07,0x06,0x02,0x02,0x02,0x02,0x02,0x06,
    0x06,0x0F,0x0F,0xBE,0xEE,0xCC,0x8C,0x0C,0x0C,0x0C,0x0E,0x1E,0x1E,0x3F,0x73,0xE1,
    0xC1,0x00,0x36,0x25,0x55,0x5D,0x49,0x6D,0x32,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x7F,0x7F,0x3F,0xFC,0xFC,0xFC,0x3C,0x1C,0x0E,
    0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x02,0x06,0x0E,0x1C,0xFC,0xFC,0xFC,0x3C,0x0E,
    0x06,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x06,0x0C,0x18,0x78,0xF0,0xF0,0x33,
    0x7F,0x7F,0x70,0xF0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xFF,0xFF,0x83,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xF0,0xF0,0xF0,0x80,
    0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0x60,0x78,0x7F,0x7F,0x7F,0x7C,0x70,
    0xE0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xE0,0xFF,0xFF,0xC0,
    0x00,0x00,0x00,0x00,0xC3,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x03,0x0F,0x3E,0xFC,0xFC,0x0E,0x03,0x03,0x03,0x03,0x07,0x07,0x0F,
    0x1F,0x3F,0x7F,0xFF,0xFF,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x01,0x03,0xFF,0xFF,0x7F,0x1F,0x0F,0x07,0x07,0x03,0x01,0x01,0x01,0x01,
    0x03,0xFE,0xFE,0x7E,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x1F,0x3C,0x78,0x70,0xE0,0xE0,0xE0,0xC0,
    0xC0,0xC0,0xC0,0xE1,0xFF,0x7F,0x7F,0x3C,0x3C,0x3C,0x38,0x30,0x30,0x30,0x30,0x38,
    0x38,0x3C,0x3C,0x7F,0xFF,0xE1,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0x60,0x70,0x38,0x38,
    0x1E,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
    0x01,0x03,0x03,0x07,0x07,0x0E,0x18,0x18,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
    0x38,0x18,0x1C,0x1E,0x0F,0x07,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
)

main()
Posts: 11
Joined: Fri Nov 16, 2012 5:50 pm
Location: Coventry, England
by buxiaoyang » Fri Dec 28, 2012 9:42 am
Got the problem in lcd_clear function please change the code to this one:
Code: Select all
def lcd_clear():
   GPIO.output(LCD_CS, False)
   for i in range(0, 8):           
      lcd_set_page(i,0)
      for j in range(0, 128):                                           
         lcd_tranfer_data(0x00,1)
   GPIO.output(LCD_CS, True)

not this one:
Code: Select all
def lcd_clear():
    GPIO.output(LCD_CS, False)
    for i in range(0, 8):           
        lcd_set_page(i, 0)
    for j in range(0, 128):                                           
        lcd_transfer_data(0x00, 1)
    GPIO.output(LCD_CS, True)


You can see in your code the second "for" statement is not in the right place, it should be included in the first "for" not in the same level. Notice the blank chars.

Shawn
Posts: 21
Joined: Wed Dec 05, 2012 1:25 pm
by ukgamer » Fri Dec 28, 2012 6:39 pm
Thanks very much for all your help. It seems to be working fine now. One last question - could you share the tool you're using to create fonts/images for the LCD?
Posts: 11
Joined: Fri Nov 16, 2012 5:50 pm
Location: Coventry, England
by buxiaoyang » Sat Dec 29, 2012 7:46 am
ukgamer wrote:Thanks very much for all your help. It seems to be working fine now. One last question - could you share the tool you're using to create fonts/images for the LCD?

I can share this small tool but unfortunately it's not base on English UI, so you may not able to use it. It's free tool, but not developed by me and I don't have the source code so i can't change the UI to English either.

If you like, you can get it from http://www.buxiaoyang.com/attachments/zimo221.zip

Shawn
Posts: 21
Joined: Wed Dec 05, 2012 1:25 pm
by heavypanther » Fri Jan 25, 2013 8:51 pm
Hi,

This code has been a great help. Unfortunately, my display flashes briefly and then remains all black. Curiously, if I remove VDD from 3V3, it works perfectly - I see the text I wanted to display.

I've played with contrast, etc. but to no avail. I don't have the LED backlight powered; I'm assuming this is not required.

Any thoughts? The code I'm running is here:

Code: Select all
import RPi.GPIO as GPIO

LCD_CS = 2
LCD_RST = 3
LCD_A0 = 4
LCD_CLK = 27
LCD_SI = 17

def main():
   io_init()
   lcd_init()
   lcd_ascii168_string(0,0,"               X")
   lcd_ascii168_string(0,2,"      The       ")
   lcd_ascii168_string(0,4," Richmond Family")
   lcd_ascii168_string(0,6,"                ")

def io_init():
   GPIO.setmode(GPIO.BCM)
   #GPIO.setwarnings(False)
   GPIO.setup(LCD_CS, GPIO.OUT)
   GPIO.setup(LCD_RST, GPIO.OUT)
   GPIO.setup(LCD_A0, GPIO.OUT)
   GPIO.setup(LCD_CLK, GPIO.OUT)
   GPIO.setup(LCD_SI, GPIO.OUT)
   
def lcd_init():
   GPIO.output(LCD_CS, True)
   GPIO.output(LCD_RST, False)                     
   GPIO.output(LCD_RST, True)
   lcd_tranfer_data(0xe2,0);    #Internal reset
   
   lcd_tranfer_data(0xa3,0);    #Sets the LCD drive voltage bias ratio
               ##A2: 1/9 bias
               ##A3: 1/7 bias (ST7565V)
               
   lcd_tranfer_data(0xa0,0);   #Sets the display RAM address SEG output correspondence
               ##A0: normal
               ##A1: reverse
               
   lcd_tranfer_data(0xc8,0);    #Select COM output scan direction
               ##C0~C7: normal direction
               ##C8~CF: reverse direction
               
   lcd_tranfer_data(0xa4,0);    #Display all points ON/OFF
               ##A4: normal display
               ##A5: all points ON
               
   lcd_tranfer_data(0xa6,0);   #Sets the LCD display normal/reverse
               ##A6: normal
               ##A7: reverse
               
   lcd_tranfer_data(0x2F,0);   #select internal power supply operating mode
               ##28~2F: Operating mode
               
   lcd_tranfer_data(0x60,0);   #Display start line set
               ##40~7F Display start address
               
   lcd_tranfer_data(0x27,0);    #V5 voltage regulator internal resistor ratio set(contrast)
               ##20~27 small~large
               
   lcd_tranfer_data(0x81,0);    #Electronic volume mode set
               ##81: Set the V5 output voltage
             
   lcd_tranfer_data(0x30,0);    #Electronic volume register set
               ##00~3F: electronic volume register
               
   lcd_tranfer_data(0xaf,0);      #Display ON/OFF
               ##AF: ON
               ##AE: OFF
   lcd_clear()                     

def lcd_ascii168_string(xPos, yPos, string):
   stringLen = len(string)
   for i in range(0, stringLen):
      lcd_ascii168(xPos+i*8,yPos,ord(string[i])-32)

def lcd_ascii168(xPos, yPos, char):
   lcd_set_page(yPos,xPos)
   for i in range(0, 8):
      lcd_tranfer_data(ASCII168[char][i],1)
   lcd_set_page(yPos+1,xPos)   
   for i in range(8, 16):
      lcd_tranfer_data(ASCII168[char][i],1)

def lcd_clear():
   GPIO.output(LCD_CS, False)
   for i in range(0, 8):           
      lcd_set_page(i,0)
      for j in range(0, 128):                                           
         lcd_tranfer_data(0x00,1)
   GPIO.output(LCD_CS, True)

def lcd_set_page(page, column):
   lsb = column & 0x0f
   msb = column & 0xf0
   msb = msb>>4
   msb = msb | 0x10                 
   page = page | 0xb0                               
   lcd_tranfer_data(page,0)
   lcd_tranfer_data(msb,0)
   lcd_tranfer_data(lsb,0)
   

def lcd_tranfer_data(value, A0):
   GPIO.output(LCD_CS, False)
   GPIO.output(LCD_CLK, True)
   if(A0):
      GPIO.output(LCD_A0, True)
   else:
      GPIO.output(LCD_A0, False)
   lcd_byte(value)
   GPIO.output(LCD_CS, True)


def lcd_byte(bits):
   tmp = bits;
   for i in range(0, 8):
      GPIO.output(LCD_CLK, False)
      if(tmp & 0x80):
         GPIO.output(LCD_SI, True)
      else:
         GPIO.output(LCD_SI, False)
      tmp = (tmp<<1)
      GPIO.output(LCD_CLK, True)
     
ASCII168=(
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#" ",0
(0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00),#"!",1
(0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#""",2
(0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00),#"#",3
(0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00),#"$",4
(0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00),#"%",5
(0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10),#"&",6
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00),#",",7
(0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00),#"(",8
(0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00),#")",9
(0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00),#"*",10
(0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00),#"+",11
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00),#",",12
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01),#"-",13
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00),#".",14
(0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00),#"/",15
(0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00),#"0",16
(0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"1",17
(0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00),#"2",18
(0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00),#"3",19
(0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00),#"4",20
(0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00),#"5",21
(0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00),#"6",22
(0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00),#"7",23
(0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00),#"8",24
(0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00),#"9",25
(0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00),#":",26
(0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00),#";",27
(0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00),#"<",28
(0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00),#"=",29
(0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00),#">",30
(0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00),#"?",31
(0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00),#"@",32
(0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20),#"A",33
(0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00),#"B",34
(0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00),#"C",35
(0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00),#"D",36
(0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00),#"E",37
(0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00),#"F",38
(0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00),#"G",39
(0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20),#"H",40
(0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"I",41
(0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00),#"J",42
(0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00),#"K",43
(0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00),#"L",44
(0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00),#"M",45
(0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00),#"N",46
(0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00),#"O",47
(0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00),#"P",48
(0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00),#"Q",49
(0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20),#"R",50
(0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00),#"S",51
(0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00),#"T",52
(0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00),#"U",53
(0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00),#"V",54
(0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00),#"W",55
(0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20),#"X",56
(0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00),#"Y",57
(0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00),#"Z",58
(0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00),#"[",59
(0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00),#"/",60
(0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00),#"]",61
(0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#"^",62
(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01),#"-",63
(0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00),#"\",64
(0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20),#"a",65
(0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00),#"b",66
(0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00),#"c",67
(0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20),#"d",68
(0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00),#"e",69
(0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"f",70
(0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00),#"g",71
(0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20),#"h",72
(0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"i",73
(0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00),#"j",74
(0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00),#"k",75
(0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00),#"l",76
(0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F),#"m",77
(0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20),#"n",79
(0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00),#"o",80
(0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00),#"p",81
(0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80),#"q",82
(0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00),#"r",83
(0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00),#"s",84
(0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00),#"t",85
(0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20),#"u",86
(0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00),#"v",87
(0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00),#"w",88
(0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00),#"x",89
(0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00),#"y",90
(0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00),#"z",91
(0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40),#"{",92
(0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00),#"|",93
(0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00),#"}",94
(0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),#"~",95
)

main()
Posts: 1
Joined: Fri Jan 25, 2013 8:48 pm
by Jammies » Fri Jun 14, 2013 2:08 pm
I know it's been a while, hope this reply helps you.

Try setting:
Code: Select all
   lcd_tranfer_data(0xa3,0);    #Sets the LCD drive voltage bias ratio
               ##A2: 1/9 bias
               ##A3: 1/7 bias (ST7565V)

To '0xa2' instead of '0xa3'. This worked for my Adafruit RGB-backlit ST7565 display. The ST7565 and the ST7565V are distinct chipsets and apparently have incompatible startup parameters.
Posts: 1
Joined: Fri Jun 14, 2013 1:59 pm
by SierraX » Mon Jul 15, 2013 6:12 am
Thank you for the whole threat...

I bought on Friday an Adafruit Graphic ST7565 Positive LCD (128x64) with RGB Backlight and extras. The extra is an HEF 4050. Unfortunately the wiring example is for an single Backlight.
My idea is to use 3 additional GPIO Ports of the Raspi to control the Cathodes of the RGB.
Is it possible to use there the needed resistors instead of the resistor at Anode?
(Edit: I found it on a Download Page from a different product of Adafruit. On CharLCDPlate the resistors all connected to the Cathodes)

By the way. In this very useful listing the for-loop in lcd_clear() goes range(0,128) means the last number is 127... anyway
On my Display (or is it my Python?) the columns starts at 1 a lcd_clear() from the listing only cleans the first 127 columns plus 1 invisible column. For the people like me who needs a long time to understand why the Display was not clean after using the command.
Posts: 1
Joined: Sat Jun 22, 2013 12:23 pm