Pic18f RTC to GLCD - Page 1
Forum section: electronics / beginners

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 12:50:09 pm
content: Hello everyone,Could somebody point me in the right direction. My problem is trying to display the time on a nokia 5110 lcd. As it stands I have interfaced the ds1306 RTC and lcd to the PIC,I have converted the packed BCD to ascii (this was for a previous uart project) From this point I'm stuck, I know that I need to somehow convert the ascii stream of data to a graphical representation for the LCD.I have googled around but found nothing. Would I be thinking down the right track if I was to use some sort of lookup table to compare the ascii data to a graphical representation? If so how do I do this?Many thanksLester

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 01:05:36 pm
content: It is not clear from your question at what point are you NOW?Do you have a 5150?Do you have the interface specs (pinout, voltage, timing, etc.)?Do you have a working electronic circuit driving the display?Do you have the software drivers to operate the interface circuit?Do you have the software to create patterns on the display?A very basic Google search revealed that all of those items are available from multiple sources.I don't really understand your question as you have stated it.

author: PA0PBZ
author_rank: Super Contributor
timestamp: December 28, 2014, 01:13:54 pm
content: If you google "nokia 5110 lcd pic18f" you get > 100K hits. I'm sure you can find what you want faster than anyone here could type the answer.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 01:24:52 pm
content: Hello.Yes I do know that that search does get 100k hits, however I need the nokia 5110 LCD to display time and date from my RTC ?

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 01:40:16 pm
content: If you are unable to articulate your question in more precise terms, it is unlikely that we can help you here.We understand your general problem statement. But we do not understand what are your specific questions?I asked you a series of very specific questions. If you are not willing to answer those, how can we help you?

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 02:07:51 pm
content: Hello I'll try to answer your questions:It is not clear from your question at what point are you NOW?Do you have a 5150? (No I'm using a Nokia 5110)Do you have the interface specs (pinout, voltage, timing, etc.) (yes I have read the data sheet, and allOf my timings and voltages correct)Do you have a working electronic circuit driving the display? (Yes my Nokia 5110 LCD is working and displaying data from the RTC but not in a readable form)Do you have the software drivers to operate the interface circuit?(yes I am using spi for RTC and the display)Do you have the software to create patterns on the display? (No I do not that's my problem, I need some sort of lookup table to display the time coming from the RTC)Thanks LesterA very basic Google search revealed that all of those items are available from multiple sources.I don't really understand your question as you have stated it.

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 02:14:19 pm
content: QuoteWhat does that mean exactly?What is it displaying now?What do you want it to display?Hint: If you make us play a game of 20 questions to drag the issue out of you, many people here who could help you will rapidly lose interest.You don't seem to be able to identify and articulate the actual issues.

author: dannyf
author_rank: Super Contributor
timestamp: December 28, 2014, 02:59:35 pm
content: QuoteThat's some definition of "working",

author: amyk
author_rank: Super Contributor
timestamp: December 28, 2014, 03:05:38 pm
content: http://en.wikipedia.org/wiki/Computer_font#Bitmap_fontsStart reading.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 04:26:34 pm
content: Hello I know about bitmap fonts.The problem is the RTC transmits data in packed BDC, which is no good for the Nokia LDC. My question is how do I go about converting BCD data to characters that can readable on the LCD?Thanks Lester

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 04:29:34 pm
content: Unpack the BCD into discrete numbers.Select the bitmap to display for each number based on the unpacked numbers.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 04:41:24 pm
content: Ok thanksHow do I go about doing this? My program is written in assembly, could you please link me to a page which describes this procedure.Many thanks Lester

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 04:54:59 pm
content: Unpacking BCD is a matter of selecting ("masking") each 4-bit digit likely using a bitwise "AND" command.And then shifting the upper 4-bit "nybble" down to create a native digit.Do you have the bitmaps for the characters (numbers) that you want to display?Do you know how to send these bitmaps to the the display?Where did you get the bitmaps? Where did you get the display drivers?You should start from those sources to fill in the details that you are asking about.Programming a PIC in assembler seems like a very difficult task for someone just learning to program.Selecting a better-supported system like Arduino, and a higher-level language (like C/Wiring) would be more beginner-friendly.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 05:17:17 pm
content: Thanks for the replyI have been working with arduino for some time. To get a better understanding of micro-controllers and how they work, I thought it would be better to select a pic and work in assembler.No I have not yet completed my bit maps (in the process)I do know how to send bitmaps to the LCDMy only problem is linking and displaying the bitmap from RTC data. I believe correct me if I am wrong, that indexed lookup tables are the way to go for this particular application.

author: Richard Crowley
author_rank: Super Contributor
timestamp: December 28, 2014, 05:38:10 pm
content: Yes, indexed lookup tables would appear to be the logical implementation.First parse out the date and time data from the RTC as the basic prerequisite.Then write the strings to the display as simple text to confirm that it is parsed and formatted correctly.Then you can lookup the bitmaps and send them out to the display.

author: dannyf
author_rank: Super Contributor
timestamp: December 28, 2014, 05:55:48 pm
content: Quotethat question would suggest that you don't understand bitmap fonts.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 28, 2014, 11:49:31 pm
content: Thanks Dan for your valuable inputThere is quite a difference between knowing about bitmaps or more generally "maps of pixels" than actually programming a micro-controller to display them.Again thank you for your valuable input on this thread.

author: dannyf
author_rank: Super Contributor
timestamp: December 29, 2014, 12:00:46 am
content: I am sorry but you cannot have anything simpler than that:1) define your font map. For simplicity, let's say that you replicate just '0'..'9'.2) Take the last 4 bit of the BDC, and index it to font map.Say you have 12 decimal. It is 0x12 in BDC. You go to the font map and pick up  and . Done.It is really THAT simple.

author: dannyf
author_rank: Super Contributor
timestamp: December 29, 2014, 12:02:22 am
content: Don't know your lcd but I wrote the very first driver for Nokia 7110 (on LPC210x chips). It is fully portable and the indexing portion should be identical between the two screens.

author: Wilksey
author_rank: Super Contributor
timestamp: December 29, 2014, 12:25:46 am
content: http://en.wikipedia.org/wiki/Binary-coded_decimalRead up on Binary Coded Decimal, just convert it to decimal then use a bitmap font table to do your mapped fonts.You can probably find a 5x7 font set on t'interweb that you can use.There is plenty of code available on the internet that converts BCD to Decimal to display on a serial port or a 2 X 16 LCD, you can use the same algorithms, there are also algorithms to convert decimal to BCD to set the time / date etc.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 29, 2014, 01:11:49 am
content: Hi wilkseyI have successfully interfaced the pic/RTC with a 2x16 numerical display. My problem is the graphical Nokia 5110 display that I'm having problems with.

author: mikerj
author_rank: Super Contributor
timestamp: December 29, 2014, 08:54:31 am
content: You need a font table, which is simply a two dimensional array that describes which pixels need to be set for a given character. Since the 5110 display is monochrome, you can represent a pixel state with a single bit, so an 8x5 pixel character can be stored in 5 bytes of memory.This is a very common display for use in e.g. Arduino projects and plenty of code exists to show how it's driven and example font tables, e.g.hereandhere. There's very little available in assembler however, so you will need to translate this yourself once you understand the principal.

author: picandmix
author_rank: Frequent Contributor
timestamp: December 29, 2014, 09:34:52 am
content: You might find some hints in this code example I found, its in 18F assembler but not a nokia screen.

author: Lesterwyatt
author_rank: Regular Contributor
timestamp: December 29, 2014, 02:34:33 pm
content: Thanks for everybody's support on this project I'm in the middle of. This project I'm in the middle of May be simple to most, however I am still wet around the ears when it comes to pic-micros and assembler. I have been delving into electronics for around 5 years, and boy how different it is to my day job as an electrician. Hats off to you electronics engineers. Most people look at the time on their phone and take it for granted, If they only new what went on inside those little chips, they would not moan about spending £10 on a cheep pay-as-you-go Nokia.I'll keep you all posted on my progress.Thanks Lester

author: Wilksey
author_rank: Super Contributor
timestamp: December 29, 2014, 10:40:26 pm
content: Your missing link is to find a 5110 GLCD Font table, and write the characters to the GLCD using the ascii value indexed font table.Just look up GLCD PIC and you will more than likely find a font table and how they use it, you can use larger fonts or smaller fonts it's just a bitmap.