Author Topic: Pic18f RTC to GLCD  (Read 6975 times)

0 Members and 1 Guest are viewing this topic.

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Pic18f RTC to GLCD
« on: December 28, 2014, 12:50:09 pm »
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 thanks
Lester
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #1 on: December 28, 2014, 01:05:36 pm »
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.
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5127
  • Country: nl
Re: Pic18f RTC to GLCD
« Reply #2 on: December 28, 2014, 01:13:54 pm »
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.
Keyboard error: Press F1 to continue.
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #3 on: December 28, 2014, 01:24:52 pm »
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 ?
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #4 on: December 28, 2014, 01:40:16 pm »
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?
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #5 on: December 28, 2014, 02:07:51 pm »
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 all
Of 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 Lester

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.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #6 on: December 28, 2014, 02:14:19 pm »
Quote
my Nokia 5110 LCD is working and displaying data from the RTC but not in a readable form
What 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Pic18f RTC to GLCD
« Reply #7 on: December 28, 2014, 02:59:35 pm »
Quote
Yes my Nokia 5110 LCD is working and displaying data from the RTC but not in a readable form

That's some definition of "working", :)
================================
https://dannyelectronics.wordpress.com/
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8275
Re: Pic18f RTC to GLCD
« Reply #8 on: December 28, 2014, 03:05:38 pm »
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #9 on: December 28, 2014, 04:26:34 pm »
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
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #10 on: December 28, 2014, 04:29:34 pm »
Unpack the BCD into discrete numbers.
Select the bitmap to display for each number based on the unpacked numbers.
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #11 on: December 28, 2014, 04:41:24 pm »
Ok thanks

How 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
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #12 on: December 28, 2014, 04:54:59 pm »
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.
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #13 on: December 28, 2014, 05:17:17 pm »
Thanks for the reply

I 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 LCD

My 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.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Pic18f RTC to GLCD
« Reply #14 on: December 28, 2014, 05:38:10 pm »
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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Pic18f RTC to GLCD
« Reply #15 on: December 28, 2014, 05:55:48 pm »
Quote
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?

that question would suggest that you don't understand bitmap fonts.
================================
https://dannyelectronics.wordpress.com/
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #16 on: December 28, 2014, 11:49:31 pm »
Thanks Dan for your valuable input :clap:

There 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Pic18f RTC to GLCD
« Reply #17 on: December 29, 2014, 12:00:46 am »
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 [1] and [2]. Done.

It is really THAT simple.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Pic18f RTC to GLCD
« Reply #18 on: December 29, 2014, 12:02:22 am »
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.
================================
https://dannyelectronics.wordpress.com/
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: Pic18f RTC to GLCD
« Reply #19 on: December 29, 2014, 12:25:46 am »
http://en.wikipedia.org/wiki/Binary-coded_decimal

Read 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.
 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #20 on: December 29, 2014, 01:11:49 am »
Hi wilksey

I 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.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Pic18f RTC to GLCD
« Reply #21 on: December 29, 2014, 08:54:31 am »
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. here and here.  There's very little available in assembler however, so you will need to translate this yourself once you understand the principal.
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Pic18f RTC to GLCD
« Reply #22 on: December 29, 2014, 09:34:52 am »
You might find some hints in this code example I found, its in 18F assembler but not a nokia screen.


 

Offline LesterwyattTopic starter

  • Regular Contributor
  • *
  • Posts: 73
  • Country: gb
    • My YouTube Channel
Re: Pic18f RTC to GLCD
« Reply #23 on: December 29, 2014, 02:34:33 pm »
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  :)
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: Pic18f RTC to GLCD
« Reply #24 on: December 29, 2014, 10:40:26 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf