Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Pi Plate Backslash

by iscool007 on Wed Feb 27, 2013 12:18 pm

I have my plate working just fine, however when I try to display a Backslash "\", I get the Yen Character "¥". I've tried using hex "5C".decode("hex") in python with no avail.
Here's my code:

Code: Select all
#!/usr/bin/python

import sys
import os
import smbus

from CharLCDPlate import CharLCDPlate

lcd = CharLCDPlate(busnum = 1)


lcd.clear()
lcd.backlight(lcd.ON)
lcd.message("Hello...")

array = ('\\', '|','/','-')
#alternate array
#array = ("5C", "7C", "2F", "2D")

while 1:
   for a in array:
      lcd.setCursor(15,0)
      lcd.message(a)
      #lcd.message(a.decode("hex"))
      sleep(.5)
iscool007
 
Posts: 2
Joined: Wed Feb 27, 2013 12:04 pm

Re: Pi Plate Backslash

by tldr on Wed Feb 27, 2013 4:11 pm

looks like you've got a controller with the japanese character set. see the datasheet. you can put characters of your own invention in the first eight character positions.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Pi Plate Backslash

by iscool007 on Wed Feb 27, 2013 8:57 pm

Thanks for the info. I looked at the datasheet: http://www.adafruit.com/datasheets/HD44780.pdf. According to page 17, character 0x5C is the Yen Character. I don't see a backslash anywhere for ROM Code: A00.
The LCD I recieved in the Adafruit LCD Pi Plate came with ROM Code A00. Seems as though backslash is not supported without creating a custom character.
iscool007
 
Posts: 2
Joined: Wed Feb 27, 2013 12:04 pm

Re: Pi Plate Backslash

by adafruit_support_rick on Thu Feb 28, 2013 5:59 am

See page 13 of the datasheet. The chip has character-generator RAM, which allows you to dynamically generate custom characters:
Character Generator RAM (CGRAM)
In the character generator RAM, the user can rewrite character patterns by program. For 5 ´ 8 dots, eight
character patterns can be written, and for 5 ´ 10 dots, four character patterns can be written.
Write into DDRAM the character codes at the addresses shown as the left column of Table 4 to show the
character patterns stored in CGRAM.
See Table 5 for the relationship between CGRAM addresses and data and display patterns.
User avatar
adafruit_support_rick
 
Posts: 8510
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Pi Plate Backslash

by tldr on Thu Feb 28, 2013 6:11 pm

try
Code: Select all
    lcd.createChar (0, [0,0,32,16,8,4,2,0])


then instead of '\\' to print a backslash use '\x00'.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Pi Plate Backslash

by pburgess on Thu Feb 28, 2013 9:53 pm

createChar() was added to the Pi code just last night, so you'll need to download the latest for this.
User avatar
pburgess
 
Posts: 2184
Joined: Sun Oct 26, 2008 1:29 am