Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

nokia 5110 using pic18F46k22

Joined
Oct 19, 2020
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
here i am tried the code below have,I want to change big size font,can anyone help me to change the font size in big..

Code:
#include <xc.h>
#include"nokia_lcd.h"
void Nokia_Init();
void Nokia_SendCommand(char);
void Nokia_SendData(char);
void Nokia_SendString(char *);
void MSdelay(unsigned int);
void Nokia_Clear();
void Nokia_PositionXY(char, char);
void SPI_Init_Master();
void SPI_Write(unsigned char x);
void setCursor(unsigned char row, unsigned char col);
void setPixel(unsigned char x, unsigned char y);
void charDisp(unsigned char a);
#define CS PORTAbits.RA5    
#define DC PORTDbits.RD7
#define RES PORTDbits.RD4
unsigned  char font[][6] =
{
  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },   // sp
    { 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 },   // !
    { 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
    { 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
    { 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 },   // $
    { 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 },   // %
    { 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 },   // &
    { 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 },   // '
    { 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 },   // (
    { 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 },   // )
    { 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 },   // *
    { 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 },   // +
    { 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 },   // ,
    { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 },   // -
    { 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 },   // .
    { 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 },   // /
    { 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E },   // 0
    { 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },   // 1
    { 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 },   // 2
    { 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 },   // 3
    { 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 },   // 4
    { 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 },   // 5
    { 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 },   // 6
    { 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 },   // 7
    { 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 },   // 8
    { 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E },   // 9
    { 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 },   // :
    { 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 },   // ;
    { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 },   // <
    { 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 },   // =
    { 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 },   // >
    { 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 },   // ?
    { 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E },   // @
    { 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C },   // A
    { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 },   // B
    { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 },   // C
    { 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C },   // D
    { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 },   // E
    { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 },   // F
    { 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A },   // G
    { 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F },   // H
    { 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 },   // I
    { 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 },   // J
    { 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 },   // K
    { 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 },   // L
    { 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F },   // M
    { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F },   // N
    { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E },   // O
    { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 },   // P
    { 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E },   // Q
    { 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 },   // R
    { 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 },   // S
    { 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 },   // T
    { 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F },   // U
    { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F },   // V
    { 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F },   // W
    { 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 },   // X
    { 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 },   // Y
    { 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 },   // Z
    { 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 },   // [
    { 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 },   // 55
    { 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 },   // ]
    { 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 },   // ^
    { 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 },   // _
    { 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 },   // '
    { 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 },   // a
    { 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 },   // b
    { 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 },   // c
    { 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },   // d
    { 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },   // e
    { 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 },   // f
    { 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C },   // g
    { 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 },   // h
    { 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 },   // i
    { 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 },   // j
    { 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 },   // k
    { 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 },   // l
    { 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 },   // m
    { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 },   // n
    { 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 },   // o
    { 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 },   // p
    { 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC },   // q
    { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 },   // r
    { 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 },   // s
    { 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 },   // t
    { 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
    { 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
    { 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
    { 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
    { 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },   // y
    { 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },   // z
    { 0x00,0x00, 0x06, 0x09, 0x09, 0x06 }    // horiz lines
};
void main()
{
    SPI_Init_Master();  /* initialize SPI master*/
    Nokia_Init();  /* initialize Nokia 5110 display */
    Nokia_Clear();  /* clear Nokia display */
    Nokia_PositionXY(0,0);  /* set X and Y position for printing */
    Nokia_SendString("SARAVANA");
    while(1);
   // {
        //Nokia_SendString("saravana");
       // Nokia_SendData('s');
  //  }
}
void Nokia_SendCommand(char cmd)
{
    DC = 0;  /* Data/Command pin, D/C=1 - Data, D/C = 0 - Command*/
    CS = 0;  /* enable chip */
    SPI_Write(cmd);  /* write command to the Nokia 5110 */
    CS = 1;  /* disable chip */
}
void Nokia_SendData(char dat)
{  
    char i;
    DC = 1;  /* Data/Command pin, D/C=1 - Data, D/C = 0 - Command*/
    CS = 0;  /* enable chip */
    for(i=0;i<6;i++)
        //SPI_Write(dat);
        SPI_Write(font[(dat) - (0x20)]);  /* write data to the Nokia 5110 */ 
    CS = 1;  /* disable chip */
}
void charDisp(unsigned char a){
    unsigned char i, b;
    if ( (a < 0x20) || (a > 0x7c) ){
        a = 92;
    }
    for(i=0;i<5;i++){
        b = font[a - 32] << 1;
         SPI_Write(b);
    }
     SPI_Write(0x00);
}
void Nokia_SendString(char data[])
{
    char j=0;
    while(data[j]!='\0')
    {   
        //charDisp(data[j]);
        Nokia_SendData(data[j]);
        j++;
    } 
    j=0;
}
void Nokia_PositionXY(char X, char Y)
{
    Nokia_SendCommand(0x80 | X);  /* set X position */
    Nokia_SendCommand(0x40 | Y);  /* set Y position */  
}

void Nokia_Init()
{
    /*apply 100 ms reset(low to high) pulse */
    RES = 0;  /* enable reset */
    MSdelay(100);
    RES = 1;  /* disable reset */
    Nokia_SendCommand(0x23);  /* display extended commands*/
    Nokia_SendCommand(0x13);  /* select Bias voltage*/
    Nokia_SendCommand(0x07);  /* set temperature coefficient*/
    Nokia_SendCommand(0xC0);  /* set LCD Vop for contrast */   
    Nokia_SendCommand(0x20);  /* display basic commands */    
    Nokia_SendCommand(0x0C);  /* set normal mode */
}

void Nokia_Clear()
{
    char i,j;
    CS = 0;
    DC = 1;
    for(i=0;i<6;i++)
    {   
        for(j=0;j<84;j++)
            SPI_Write(0);  /*write 0 to clear display */
    }      
    CS = 1;    
}
void MSdelay(unsigned int val)
{
     unsigned int i,j;
        for(i=0;i<=val;i++)
            for(j=0;j<81;j++);  /*This count Provide delay of 1 ms for 8MHz Frequency */
}
void setPixel(unsigned char x, unsigned char y)
{
    Nokia_SendCommand(0x40|(y&0x07));    // Y axis
    Nokia_SendCommand(0x80|(x&0x7f));    // X axis
}

void setCursor(unsigned char row, unsigned char col){
    if((row>6) || (row<1) || (col<1) || (col>14))
        return;
    setPixel(((col-1)*6),(row-1));
}
void SPI_Init_Master()
{  
    TRISC =0X10;
    PORTC=0X00;    
    TRISD=0X00;
    PORTD=0X00;    
    TRISA=0X00;     
    PORTA=0X00;
    ANSELA=0X00;
    ANSELD=0X00;
    ANSELC=0X00;
    CS = 1;
    SSPSTAT=0x40;  
    SSPCON1=0x22;   
    SSPIF=0;
    //ADCON0=0;      
    //ADCON1=0x0F;      
}

void SPI_Write(unsigned char x)
{
    unsigned char data_flush;
     SSPBUF=x;                   /* put data in SSBUF which has to transmit */

    while(!SSPIF);      /* wait for complete 1 byte transmission */
    SSPIF=0;            /* clear SSPIF flag */
    data_flush=SSPBUF;           /* flush the data as simultaneous read occurs */
}
 
Last edited by a moderator:

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,409
Helped
284
Reputation
568
Reaction score
271
Trophy points
1,363
Location
France 01800
Activity points
9,826
hello,

is you display a 6x14 chars or 8x16 chars ?

what is big size for you ?
1 char defined by 8x16 pixel ?
or 16x16 pixel ?
for what ascii : only number 0 to 9 plus decimal point + blank
or for ascii value 32 to 127 ?
or ???

explain what do you want to display ..



so, you need to add a specifique Font_X_Y[] wich contains all your chars definition
in RAM or Flash Rom ?
be carrefull with the global size of used RAM ...

example of font 12x16 for ILI925 display



or use a BMP file for big title ?

MikroC_EveryWhere_BMP_with_Paintuino.gif
 

Attachments


Joined
Oct 19, 2020
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
thank you,actually i use only 2 lines in nokia 5110 lcd,so I want to display a 7 character per line,i am new in the embedded c code,i have some little confusion about data flow to nokia 5110 lcd,please clear me,i am using pic18f46k22,please post font in 2d array.
thank you
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,409
Helped
284
Reputation
568
Reaction score
271
Trophy points
1,363
Location
France 01800
Activity points
9,826
hello,

i give you some help, not all the program !
you can use a table of 5x7 pixel per char , and double the width to obtain Bold char with size 10x7 pixels so 8 chars max per ligne
with Height not changed ..=8 pixels => 6 lines possible with LCD 84x64
Use Hardware SPI is more confortable with this PIC ..

*for more bigger char, use a table of 12x8 ! 6 lines of 7 chars

Code:
unsigned char  LcdCache [768];            //   need 768 ! for LCD 96x64   , less for lcd 84x43
//Table 5x7   96 rows * 5 bytes= 480 bytes
const char TABLE_car[480]=
                 {0x00,0x00,0x00,0x00,0x00,   // 20 space  ASCII table for NOKIA  96x64
                  0x00,0x00,0x5f,0x00,0x00,   // 21 !
                  0x00,0x07,0x00,0x07,0x00,   // 22 "
                  0x14,0x7f,0x14,0x7f,0x14,   // 23 #
                  0x24,0x2a,0x7f,0x2a,0x12,   // 24 $
                  0x23,0x13,0x08,0x64,0x62,   // 25 %
                  0x36,0x49,0x55,0x22,0x50,   // 26 &
                  0x00,0x05,0x03,0x00,0x00,   // 27 '
                  0x00,0x1c,0x22,0x41,0x00,   // 28 (
                  0x00,0x41,0x22,0x1c,0x00,   // 29 )
                  0x14,0x08,0x3e,0x08,0x14,   // 2a *
                  0x08,0x08,0x3e,0x08,0x08,   // 2b +
                  0x00,0x50,0x30,0x00,0x00,   // 2c ,
                  0x08,0x08,0x08,0x08,0x08,   // 2d -
                  0x00,0x60,0x60,0x00,0x00,   // 2e .
                  0x20,0x10,0x08,0x04,0x02,   // 2f /
                  0x3e,0x51,0x49,0x45,0x3e,   // 30 0
                  0x00,0x42,0x7f,0x40,0x00,   // 31 1
                  0x42,0x61,0x51,0x49,0x46,   // 32 2
                  0x21,0x41,0x45,0x4b,0x31,   // 33 3
                  0x18,0x14,0x12,0x7f,0x10,   // 34 4
                  0x27,0x45,0x45,0x45,0x39,   // 35 5
                  0x3c,0x4a,0x49,0x49,0x30,   // 36 6
                  0x01,0x71,0x09,0x05,0x03,   // 37 7
                  0x36,0x49,0x49,0x49,0x36,   // 38 8
                  0x06,0x49,0x49,0x29,0x1e,   // 39 9
                  0x00,0x36,0x36,0x00,0x00,   // 3a :
                  0x00,0x56,0x36,0x00,0x00,   // 3b ;
                  0x08,0x14,0x22,0x41,0x00,   // 3c <
                  0x14,0x14,0x14,0x14,0x14,   // 3d =
                  0x00,0x41,0x22,0x14,0x08,   // 3e >
                  0x02,0x01,0x51,0x09,0x06,   // 3f ?
                  0x32,0x49,0x79,0x41,0x3e,   // 40 @
                  0x7e,0x11,0x11,0x11,0x7e,   // 41 A
                  0x7f,0x49,0x49,0x49,0x36,   // 42 B
                  0x3e,0x41,0x41,0x41,0x22,   // 43 C
                  0x7f,0x41,0x41,0x22,0x1c,   // 44 D
                  0x7f,0x49,0x49,0x49,0x41,   // 45 E
                  0x7f,0x09,0x09,0x09,0x01,   // 46 F
                  0x3e,0x41,0x49,0x49,0x7a,   // 47 G
                  0x7f,0x08,0x08,0x08,0x7f,   // 48 H
                  0x00,0x41,0x7f,0x41,0x00,   // 49 I
                  0x20,0x40,0x41,0x3f,0x01,   // 4a J
                  0x7f,0x08,0x14,0x22,0x41,   // 4b K
                  0x7f,0x40,0x40,0x40,0x40,   // 4c L
                  0x7f,0x02,0x0c,0x02,0x7f,   // 4d M
                  0x7f,0x04,0x08,0x10,0x7f,   // 4e N
                  0x3e,0x41,0x41,0x41,0x3e,   // 4f O

                  0x7f,0x09,0x09,0x09,0x06,   // 50 P
                  0x3e,0x41,0x51,0x21,0x5e,   // 51 Q
                  0x7f,0x09,0x19,0x29,0x46,   // 52 R
                  0x46,0x49,0x49,0x49,0x31,   // 53 S
                  0x01,0x01,0x7f,0x01,0x01,   // 54 T
                  0x3f,0x40,0x40,0x40,0x3f,   // 55 U
                  0x1f,0x20,0x40,0x20,0x1f,   // 56 V
                  0x3f,0x40,0x38,0x40,0x3f,   // 57 W
                  0x63,0x14,0x08,0x14,0x63,   // 58 X
                  0x07,0x08,0x70,0x08,0x07,   // 59 Y
                  0x61,0x51,0x49,0x45,0x43,   // 5a Z
                  0x00,0x7f,0x41,0x41,0x00,   // 5b [
                  0x02,0x04,0x08,0x10,0x20,   // 5c
                  0x00,0x41,0x41,0x7f,0x00,   // 5d
                  0x04,0x02,0x01,0x02,0x04,   // 5e
                  0x40,0x40,0x40,0x40,0x40,   // 5f
                  0x00,0x01,0x02,0x04,0x00,   // 60
                  0x20,0x54,0x54,0x54,0x78,   // 61 a
                  0x7f,0x48,0x44,0x44,0x38,   // 62 b
                  0x38,0x44,0x44,0x44,0x20,   // 63 c
                  0x38,0x44,0x44,0x48,0x7f,   // 64 d
                  0x38,0x54,0x54,0x54,0x18,   // 65 e
                  0x08,0x7e,0x09,0x01,0x02,   // 66 f
                  0x0c,0x52,0x52,0x52,0x3e,   // 67 g
                  0x7f,0x08,0x04,0x04,0x78,   // 68 h
                  0x00,0x44,0x7d,0x40,0x00,   // 69 i
                  0x20,0x40,0x44,0x3d,0x00,   // 6a j
                  0x7f,0x10,0x28,0x44,0x00,   // 6b k
                  0x00,0x41,0x7f,0x40,0x00,   // 6c l
                  0x7c,0x04,0x18,0x04,0x78,   // 6d m
                  0x7c,0x08,0x04,0x04,0x78,   // 6e n
                  0x38,0x44,0x44,0x44,0x38,   // 6f o
                  0x7c,0x14,0x14,0x14,0x08,   // 70 p
                  0x08,0x14,0x14,0x18,0x7c,   // 71 q
                  0x7c,0x08,0x04,0x04,0x08,   // 72 r
                  0x48,0x54,0x54,0x54,0x20,   // 73 s
                  0x04,0x3f,0x44,0x40,0x20,   // 74 t
                  0x3c,0x40,0x40,0x20,0x7c,   // 75 u
                  0x1c,0x20,0x40,0x20,0x1c,   // 76 v
                  0x3c,0x40,0x30,0x40,0x3c,   // 77 w
                  0x44,0x28,0x10,0x28,0x44,   // 78 x
                  0x0c,0x50,0x50,0x50,0x3c,   // 79 y
                  0x44,0x64,0x54,0x4c,0x44,   // 7a z
                  0x00,0x08,0x36,0x41,0x00,   // 7b
                  0x00,0x00,0x7f,0x00,0x00,   // 7c
                  0x00,0x41,0x36,0x08,0x00,   // 7d
                  0x10,0x08,0x08,0x10,0x08,   // 7e
                  0x78,0x46,0x41,0x46,0x78   // 7f
};


sbit Nokia_DC at LATC.B0; // /DC (DC barre!) choix DATA=1 ou Cde=0
sbit Nokia_CE at LATC.B1; // /CE (CE Barre!)Chip Enable
sbit Nokia_RST at LATC.B2; // / Reset (Reste Barre!)
sbit Nokia_SCLK at LATC.B3; // SSP1 clock
sbit Nokia_MOSI at LATC.B5; // SSP1 Dout MOSI

void    Nokia_Print_Str(char *ptr,char Bold);         // size 5x7 ou 10x7

void Nokia_Write_Donnee(char Nokia_data)
{
Nokia_CE=0;   // chip enabled
Nokia_DC=1;
Delay_us(25);
SPI1_Write(Nokia_data);
Nokia_CE=1;   // chip disabled
}


void Nokia_Print_Char(Byte cvar,char Bold)        // Write 1 character to LCD
{
charsel=cvar;
if (charsel<0x0020)return;
if (charsel>0x007f)return;
for (char_row=0;char_row<5;char_row++)
  {    // 5 bytes largeur matrice caractere
   charpos=(charsel-0x0020)*5;
   chardata=TABLE_car[(charpos+char_row)];
   Nokia_Write_Donnee(chardata);      // send data to nokia
   Lcd_Pos++;
   Lcd_Cache[LcdPos]= chardata;
   if(Bold>0)
   {
    Nokia_Write_Donnee((Byte)chardata);
    Lcd_Pos++;
    Lcd_Cache[LcdPos]= chardata;
    }
}
Lcd_Pos++;
Nokia_Write_Donnee(0x00);      //    1 byte (always blank)
Lcd_Cache[LcdPos]= 0;
}


void Nokia_Write_Text(char *ptr,char Bold)
{
  while(*ptr!=0)
  {
      Nokia_Print_Char(*ptr++,Bold);
      Delay_us(200);
   }
}
 
  
===========================  
main code
.....   hardware init ..etc ...

   SLRCON = 0;
   ANSELC = 0;
  TRISC=0b10000000;

  //REGISTER 3-2: PMD1: PERIPHERAL MODULE DISABLE REGISTER 1
  //MSSP2MD MSSP1MD — CCP5MD CCP4MD CCP3MD CCP2MD CCP1MD
  PMD1=0b10111111; // only MSS1P enabled;

  Nokia_DC_Dir  =0;
  Nokia_CE_Dir =0;
  Nokia_RST_Dir =0;
  Nokia_MOSI_Dir=0;
  Nokia_SCLK_Dir =0;

  Nokia_MOSI=0;
  Nokia_DC=0;   // byte is a command
  Nokia_CE=0;   // chip enabled
  Nokia_RST=0;
 Nokia_SCLK=0;
  Delay_ms(100);
  Nokia_RST=1;
 
   Nokia_CE=1;  
  
  CRLF1();
  UART1_Write_CText(" Test Nokia 5110  \r\n");
  UART1_Write_CText(" SPI1 Hardware  advanced mode! \r\n");
  CRLF1();

  ADC_Init();  
  
  
Nokia_DC=0;   // byte is a command
Nokia_CE=0;   // chip enabled
Nokia_RST=0;
Delay_ms(100);
Nokia_RST=1;
 Nokia_SCLK=1;
Nokia_CE=1;
Delay_ms(100);

  SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW,_SPI_LOW_2_HIGH);
  SPI_Set_Active(&SPI1_Read, &SPI1_Write); // Sets the SPI1 module active

UART1_Write_CText(" Init Nokia \r\n");
 Delay_ms(1000);
  Nokia_Init();
 Nokia_Raz_Lcd_Cache() ; // mode grafique


   strConstRamCpy(txt,"BASE 18F26K22   ");
   Nokia_Gotoxy(0,1);
    Nokia_Write_Text(txt,0);  // 0= size  5x7
    EA1=ADC_Get_Sample(1);
    f1=(float)EA1*4.00/1024.0;  // Vdd=4V
    strConstRamCpy(txt,"E1=           ");
    fltToa (f1,txt+3,2);
    Nokia_Write_Text_At(0,2,txt,1); // 1= big size 10x7
    Delay_ms(50
 

Attachments

Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,415
Helped
4,112
Reputation
8,224
Reaction score
4,046
Trophy points
113
Activity points
121,223
Hi,

please do an internet search for Nokia5110 large fonts.

Klaus
 

Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top