CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Library for using nokia 5110 lcd ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

Library for using nokia 5110 lcd ?
PostPosted: Sun Dec 24, 2017 2:16 am     Reply with quote

Hello
  Is there a library in ccs to launch lcd nokia 5110?
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 5:27 am     Reply with quote

There isn't any such thing!..... Evil or Very Mad

What is commonly referred to as the 5110, is the display _from_ the Nokia 5110 phone. This is actually controlled by a PCD8544, and it is this you would need to talk to.
Fortunately, this controller is also used by the Nokia 3110.
If you look at the link from this thread:
<https://www.ccsinfo.com/forum/viewtopic.php?p=121962>
This takes you to a driver for this.

There is also a graphics driver here:
<http://www.magusporta.com/tips/nokia_driver/nokia_driver.html>

However for the graphics driver you need 504 bytes of RAM. Whether this is acceptable depends on your PIC....
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 6:38 am     Reply with quote

also....
be sure the hardware is CORRECT ! Check the VDD supply for the LCD. Nowadays peripherals are usually 3 volt devices so choose a 3 volt operating PIC OR have appropriate 'logic level conversion' interface devices between the PIC and LCD.

Good code (aka driver) will NOT work if the hardware is wrong !!

Jay
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 7:21 am     Reply with quote

Thanks, but how should I use this code and add it to the library?
<http://www.magusporta.com/tips/nokia_driver/nokia_driver.html>

In the meantime, I think that the display works with spi communication, but there is no news in this code?
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 8:16 am     Reply with quote

yes, that driver uses SPI. A 'driver' is only code that allows you access to a peripheral. YOU have to code in main(), what you want to be displayed and where.
you'll need to tell use which PIC and which 'LCD' you are using. I'm sure there are hundreds of 'test' programs for that display as it's very common BUT FIRST you need to get your PIC 'up and running', the simple flash LED at 1Hz is a good start.

jay
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 9:56 am     Reply with quote

I do not understand how to use this driver. Do I have to turn myself on spi.
Like the code below:
If possible, please include an example with the code.
Code:

#include <16f1829.h>
#device *=16
#fuses HS             //High speed Osc (> 4mhz for PCM/PCH)
#fuses NOWDT            //NO Watch Dog Timer
#fuses PUT            //Power Up Timer
#fuses NOLVP          //No low voltage programing
#fuses NOCPD          //No EE protection
#fuses NOPROTECT      //Code not protected from reading
#fuses NOWRT          //Program memory not write protected
#fuses NODEBUG        //No Debug mode for ICD
#fuses NOBROWNOUT     //No brownout reset
#USE DELAY (crystal=11059200)

#use spi(DO=PIN_B4, CLK=PIN_B6,BITS=16)
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <Nokia_5110.c>

void main()
{

nokia_init();


while(TRUE)
{
nokia_line(10,10,50,50,50);
nokia_circle(10,20,20,10,2);
}
}
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 10:25 am     Reply with quote

a question. Have you got your PIC to toggle an LED at 1Hz ?
then..
first problem...
the driver has this as code...
...
//Communication PINS between PIC and LCD
#define nok_sclk PIN_C4 // nokia lcd sclk PIN 5
#define nok_sda PIN_C3 // nokia lcd sda PIN 4
#define nok_dc PIN_C2 // nokia lcd d/c PIN 3
#define nok_cs PIN_C1 // nokia lcd cs PIN 2
#define nok_res PIN_C0 // nokia lcd res PIN 1
...

A quick look at the driver and it is NOT using SPI, well at least not hardware SPI. What is NOT specified in the driver is the PIC's required clock speed. Perhaps you can locate that as it is rather CRITCAL to know.
It appears to be bitbanging the I/O pins so timing is important.
I do not have that PIC or a Nokia LCD here for testing.
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 11:04 am     Reply with quote

This lcd and microcontroller are in proteus.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 11:43 am     Reply with quote

Seriously, you ae wasting your time (and ours).
Read the sticky at the head of the forum about Proteus.

The Proteus simulation of PIC's is poor. You can spend ages gettng a design to work, and then when you try it on a real PIC you have to start again because 90% of the time it won't work. Then conversely you can take a real PIC design that works fine, and try it in the simulator and it doesn't work.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 1:19 pm     Reply with quote

aarrgh...
As Mr. T says, it will NEVER, EVER work in Proteus. Actually I take that back...If YOU rewrite the source code of Proteus to correct for the 3000 to 4000 things KNOWN TO BE WRONG with it, then maybe it might 'work' but whatever is drawn won't in the real World
The good part is that PIC WILL work on 3 volts so interfacing to the Nokia is child's play.

Jay
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Sun Dec 24, 2017 11:55 pm     Reply with quote

Yes, I know the proteus defects.
But now I just want to know how to use this driver that you put in someone and write the program.

Because there is some function inside this driver.
The driver is at the following link:
<http://www.magusporta.com/tips/nokia_driver/nokia_driver.html>

And on the other hand, the LCD works with the spi interface, but inside this driver is not something to activate the spi connection.
Should I activate the spi connection myself within the program or do not need it ?
Thank you for the answer.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 25, 2017 1:35 am     Reply with quote

The nokia_5110.c driver uses software SPI. You don't need to add the
#use spi() statement. The driver handles all SPI communication.

To use the driver,

1. First you must call nokia_init() at the start of main().

2. Then you can write to a RAM buffer (in the driver) with any of the following functions:
Code:

nokia_printchar(int8 c);   
nokia_printstr(char* message); 
nokia_plot(int8 x, int8 y, int1 color); 
nokia_line(unsigned int8 x1, unsigned int8 y1, unsigned int8 x2, unsigned int8 y2, int1 color);
nokia_box(unsigned int8 x1, unsigned int8 y1, unsigned int8 x2, unsigned int8 y2, int1 fill, int1 color);
nokia_bar(unsigned int8 x1, unsigned int8 y1, unsigned int8 x2, unsigned int8 y2, unsigned int8 width, int1 color);
nokia_circle(unsigned int8 x, unsigned int8 y, unsigned int8 radius, int1 fill, int1 color);


3. After using one or more of those functions, you can copy the RAM
buffer to the Nokia LCD with the refresh function. Example:
Code:

nokia_printchar('A');
nokia_refresh();

After you call the refresh function, then you will see the results on the Nokia lcd screen.

4. To erase the Nokia LCD screen, call the following functions:
Code:

nokia_clean_buffer();
nokia_refresh();
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Mon Dec 25, 2017 3:50 am     Reply with quote

I was able to launch it with this method.
Thank you very much Very Happy Very Happy Very Happy Very Happy
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Mon Dec 25, 2017 12:33 pm     Reply with quote

HI.AGAIN
I started this display with the way you said, but the following functions do not work:
How to use these two functions
Code:

nokia_bigc(c)

and
Code:

nokia_bitmap(rom *bitmap,bx,by,xdim,ydim,color,align) 

Thanks again for help
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 25, 2017 12:40 pm     Reply with quote

Post your test program that shows how you are using these two functions.
Don't post the driver. Just post your small test program.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group