Shop OBEX P1 Docs P2 Docs Learn Events
Degree symbol — Parallax Forums

Degree symbol

NewzedNewzed Posts: 2,503
edited 2005-10-08 17:12 in BASIC Stamp
I am unable to display the degree symbol, ASCII 186, on my LCD.· It does display on the debug screen.· Does this have to be a custom character?

SEROUT lcd, Baud, [noparse][[/noparse]L1, "Temp:· ", dec tF/10, 186,· " F"]·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html

·

Comments

  • Mike CookMike Cook Posts: 829
    edited 2005-10-06 21:41
    On my LCD2041, I use decimal 223 to display the degree symbol

    Mike



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

  • NewzedNewzed Posts: 2,503
    edited 2005-10-06 21:59
    If I write DEC 223 it displays "223".· If I write 223, it displays nothing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Mike CookMike Cook Posts: 829
    edited 2005-10-06 22:34
    Sid,
    I guess my Matrix Orbital LCD2041 is different than your serial display. Using the following line of code:
    SEROUT LCDpin, N19200, [noparse][[/noparse]"Temp is: 65", 223, "F"]
    Prints the degree symbol on mine.
    Mike



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

    Post Edited (Mike Cook) : 10/6/2005 11:36:15 PM GMT
    874 x 339 - 73K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-06 23:15
    Sid,
    ·· If you check the documentation for the Display you will find that character is not implemented and must be created as a custom character.· Here is a DATA statement with the character data, code to load it and·the line to display it.
    ' LCD CONSTANTS
     
    LcdCls          CON     $0C             ' Clear LCD (Use PAUSE 5 After)
    LcdCR           CON     $0D             ' Move Pos 0 Of Next Line
    LcdBLon         CON     $11             ' Backlight On
    LcdBLoff        CON     $12             ' Backlight Off
    LcdOff          CON     $15             ' LCD Off
    LcdOn1          CON     $16             ' LCD On; Cursor Off, Blink Off
    LcdOn2          CON     $17             ' LCD On; Cursor Off, Blink On
    LcdOn3          CON     $18             ' LCD On; Cursor On, Blink Off
    LcdOn4          CON     $19             ' LCD On; Cursor On, Blink On
    LcdLine1        CON     $80             ' Move To Line 1, Column 0
    LcdLine2        CON     $94             ' Move To Line 2, Column 0
    LcdCC0          CON     $F8             ' Define Custom Char 0
    LcdCC1          CON     $F9             ' Define Custom Char 1
    LcdCC2          CON     $FA             ' Define Custom Char 2
    LcdCC3          CON     $FB             ' Define Custom Char 3
    LcdCC4          CON     $FC             ' Define Custom Char 4
    LcdCC5          CON     $FD             ' Define Custom Char 5
    LcdCC6          CON     $FE             ' Define Custom Char 6
    LcdCC7          CON     $FF             ' Define Custom Char 7
     
     
    ' EEPROM DATA
     
    CC0             DATA    LcdCC0, $0C, $12, $12, $0C, $00, $00, $00, $00
    
     
    ' LCD INITIALIZATION CODE
     
      HIGH LCD                              ' Setup Serial Output Pin
      PAUSE 100                             ' Give LCD Time To Settle
    Download_Chars:
      FOR index = 0 TO 8                    ' Download Custom Characters
        READ CC0 + index, work              ' Read EEPROM Data
        SEROUT LCD, Baud, [noparse][[/noparse]work]            ' Send To LCD CGRAM
      NEXT
      SEROUT LCD, Baud, [noparse][[/noparse]LcdOn1, LcdBLon]   ' Turn LCD Display & Backlight On
      PAUSE 10
      SEROUT LCD, Baud, [noparse][[/noparse]LcdCls]            ' Clear LCD Screen
      PAUSE 10
     
    ' DISPLAY TEMP AND DEGREE SYMBOL
     
    Show_Temp:
      SEROUT LCD, Baud, [noparse][[/noparse]"  ", DEC2 tempF, 0, "F "
    
    

    These routines are from different sections of the code and must be placed in their respective areas.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-10-06 23:29
    What display is it Sid? Usually the documentation will include a table with the character set. Where did you get the idea that 186 would be the decimal point?

    Like Mike, I've used ascii code 223 for the degree symbol.

    In fact, i have data sheets for both the ubiquitous HD44780U controller, and for the Seetron ILM216 here in front of me, and both show ascii 223 as the degree symbol.

    In a pinch, you can use an apostophe 39, accent 96 or carat 94. Or define your own in the character RAM as Chris suggested.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-06 23:42
    Sorry for the confusion, my information was based on the assumption it is one of our modules.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NewzedNewzed Posts: 2,503
    edited 2005-10-06 23:42
    Tracy, it's the 2x16 serial LCD from Parallax.· I wrote:

    serout lcd, baud, [noparse][[/noparse]"Temp· :', dec tf, 223, " F"]

    an all I got was

    Temp:· 84 F

    I'd really like to use the degree symbol if I can get it to display.· Am I doing something wrong.



    Sid
  • Mike CookMike Cook Posts: 829
    edited 2005-10-06 23:52
    Sid,

    Just checked the documentation on the Parallax Serial LCD (#27976/27977)

    It only supports characters (decimal) 32-127, looks like you will have to do what Chris suggested and make a custom character.

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

    361 x 674 - 62K
  • NewzedNewzed Posts: 2,503
    edited 2005-10-07 12:15
    Chris, I am trying to follow your code example.· I understand everything but this line:

    SEROUT LCD, Baud, [noparse][[/noparse]"· ", DEC2 tempF, 0, "F "

    What does the " 0 " refer to?· You wrote:

    LcdCC0········· CON···· $F8············ ' Define Custom Char 0····

    and

    Download_Chars:
    · FOR index = 0 TO 8··················· ' Download Custom Characters
    ··· READ CC0 + index, work············· ' Read EEPROM Data
    ··· SEROUT LCD, Baud, [noparse][[/noparse]work]··········· ' Send To LCD CGRAM
    · NEXT

    It looks like the serout to the LCD should use $F8 or work instead of 0.

    Can you clarify - sorry to be so dumb.

    Sid
  • Mike CookMike Cook Posts: 829
    edited 2005-10-07 12:30
    According to the manual:

    $F8 is the command to Define custom character 0. This command must be followed by eight data bytes.

    The routine:

    FOR index = 0 TO 8 ' Download Custom Characters

    · READ CC0 + index, work ' Read EEPROM Data

    · SEROUT LCD, Baud, [noparse][[/noparse]work] ' Send To LCD CGRAM

    NEXT

    Loads the data statement:

    CC0 DATA LcdCC0, $0C, $12, $12, $0C, $00, $00, $00, $00

    That defines the "Degree" symbol (custom character)

    To print the custom character loaded in to $F8 you would use the serial LCD display's command $0 to display the custom character.

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

  • NewzedNewzed Posts: 2,503
    edited 2005-10-07 12:39
    Thanks, Mike.· I'll see if I can make that work.

    Sid
  • Mike CookMike Cook Posts: 829
    edited 2005-10-07 13:14
    Sid,

    You can do quite a bit with the custom characters. I did a Model Rocket launch controller about 5 years ago using a 4 line by 20 column Matrix Orbital LCD2041 serial display. I was able to define the rocket graphic and the animated "Flames" using all 8 custom characters. The rocket and flames were animated on several screens:

    1. Rocket came down backwards when the display told the user to "Position Rocket on Launch Pad"

    2. Rocket flashed when there was no continuity

    3. Rocket flew "up" when the continuity tested "false" and the pad detect switch went "false" within a couple of seconds of each other.

    Attached is an Excel sheet that I used to create the display graphics, so I would know what it would look like before I wrote any code.

    Good luck with your project,

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

  • NewzedNewzed Posts: 2,503
    edited 2005-10-07 13:38
    Very clever, Mike.· When I finish this project, I have a 4x24 I'll have to play around with.

    Sid
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-07 14:20
    Sid,

    ·· Did you understand the code in the end?· I have been using that in several projects for temperature.· In fact I like the symbol I drew better than the stock symbol mentioned above, since on the LCD it tends to look more like a square.· You can also re-use CGRAM Characters on an LCD.

    ·· You have 8 custom characters to use, but that doesn't necessarily limit you to 8 characters.· Sometimes you might need custom characters for a splash screen that may never get used again.· You can always download the characters, display them, and then re-write them before you need the new ones.· Also note that on most HD44780-compatible displays you can re-write the CGRAM (Custom characters) while they're being displayed and they will change on the display.· This can be used to simulate animation of a cell.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NewzedNewzed Posts: 2,503
    edited 2005-10-07 23:11
    My LCD now displays a degree symboljumpin.gif

    Thank you, Chris.· Thank you, Mike.

    Sid
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-07 23:14
    Sid,

    ·· Glad you got it working.· I have been also working on a few examples for our display to share, such as two versions of a bar graph routine.· Either one will allow you to define a total and current count and display a Bar Graph on the display representing the percentage.· I hope to have these posted this weekend.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NewzedNewzed Posts: 2,503
    edited 2005-10-08 15:35
    Chris, I'm trying to figure out how you coded the degree symbol.· I seem to remember a special chart for creating custom characters but I can't find it.· It does not show up in any of the 4 LCD data sheets that I have.

    Sid
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-08 15:38
    Sid,

    ·· On the following page you will find what I used to create these characters.· It's a program Jon Williams wrote some time ago that gives you a data statement to match what needs to be downloaded into a Hitachi-Compatible display to get the character.· Plus it's easier to use than Graph Paper.

    http://www.parallax.com/html_pages/downloads/software/software_LCDCC.asp

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Mike CookMike Cook Posts: 829
    edited 2005-10-08 15:56
    Programs that create custom LCD characters are great, but before they existed I always did it this way:
    The custom characters are five pixels wide by eight pixels high.
     
    In the table below the "." is a pixel ON and the "_" is a pixel OFF
     
    HEX Binary 5x8 Character
    $0C 01100  _..__
    $12 10010  .__._
    $12 10010  .__._
    $0C 01100  _..__
    $00 00000  _____
    $00 00000  _____
    $00 00000  _____
    $00 00000  _____
    
    

    By doing it manually it helps me fully understand what's going on.

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

  • NewzedNewzed Posts: 2,503
    edited 2005-10-08 16:20
    Chirs, before I saw your post, I drew it out in Excel and used Mike's way.· Now I understand how you coded it.· Nonetheless, I shall down load Jon's program and give it a whirl.· Maybe I can create all sorts of custom characters· yeah.gif

    Thanks again to both of you.

    Sid
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-08 16:29
    Back in my Z80 days on the Parallel LCDs I used graph paper, so Mike, I do understand your point.· But I now use use the tools that are available.· Why not use the tools if you have them?· No sense in hand-assembling pneumonics for machine language when you have an assembler.· =)

    Not to mention, along your last comment Sid, I do have quite a library of custom characters.· I have the digits 0-9 from the "byte" font.· Several symbols used in controllers I have built.· Audio symbols for my amplifier systems, and even a few funny ones, like all the pieces for the Pac-Man animation, as well as a ghost animation (As in the ghost from Pac-Man).· I think I have an animated torch as well.· The animated ones look cool if you know how to use them.

    You may have seen an·Pac-Man animation from Parallax (Jon Williams), however you can animate characters in a single position on the display.· The torches were used on either side of the Splash Screen on a product I helped a friend build.· The character was cycled through 3 different frames of animation by re-setting the CGRAM location for that character.· It was a nice effect.· I will have to do another demo of it.· I also once saw an article for an Odometer style LCD display where the digits looked like they rolled up the screen because they were re-programmed on the fly to look like that.· Anyone know the link to that page?

    [noparse][[/noparse]EDIT]· Found it! [noparse][[/noparse]/EDIT]

    http://www.seetron.com/an_odo1.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 10/8/2005 4:38:36 PM GMT
  • Mike CookMike Cook Posts: 829
    edited 2005-10-08 16:43
    Chris,

    I do agree, I ended up writing a character coder for the "Model Rocket Launch Controller" in vB so I could quickly, and frequently during development, generate an eeprom table for BASCOM-AVR. This speeded up development of the project.

    But I do believe when you are learning the "ropes" it is fundamental to understand how to it by hand, because sometimes the "crutches" that I might rely on may not be handy.

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99

    Product web site: http://www.allsurplus.net/Axiom/

  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-10-08 16:51
    The rolling odometer display as well as a cool online Java base character generator and other neat stuff about LCDs can be found on Sir Scott Edwards' site:

    www.seetron.com/lcd_andex.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-08 17:12
    Mike Cook said...(trimmed)
    But I do believe when you are learning the "ropes" it is fundamental to understand how to it by hand, because sometimes the "crutches" that I might rely on may not be handy.
    Mike,

    ·· You point is correct, and well taken.· It is true you should understand the fundamentals of how something works if you plan to use it.· I face this everytime I do an Ohm's Law calculation.· I understand Ohm's Law.· I've been using it for many years.· However, I find myself having to re-think the calculations at work when I use the Windows Calculator instead of my Engineering Calculator I have at home, which displays everything in direct electrical formulas and notations.· I guess to some degree (No pun intended) that lends some credibility to your statement.· Thanks for you input.· =)

    Tracy,

    ·· Yes, Scott Edwards was the inspiration for us all when it came to LCDs, and later the savior of many when he released an inexpensive Serial Backpack for LCD Displays.· I will admit I stuck with Parallel Displays myself, but I knew a handful of people who stayed away from LCDs until Serial Interface was available.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 10/8/2005 5:15:15 PM GMT
Sign In or Register to comment.