Nokia lcd include , small footprint to suit pic16's - Page 2


Closed Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 111
  1. #41
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    works perfectly if done correctly the include's order may matter, ioc int needs to configured
    if your programmer is still connected to portb.7 that can load things up a bit [I leave mine connected and avoid using b6,b7 pins]
    never use portx.x to set or clear pins , its just asking for rmw problems especially with fast fosc settings
    always use latx.x when available or use a shadow register



    Code:
    #CONFIG ; 16F1847.
            __config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF
            __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    @ ERRORLEVEL -306   ; turn off crossing page boundary message
     
    ; --- *** Oscillator  *** ---------------------------------------------------
    define      OSC         32
    OSCCON = %11110000   ; 32 MHz, 
    ANSELA = 0           ; all digital          
    ANSELB = 0           ; all digital 
    TRISA=%10010000
    'TRISB=%00000000
    TRISB=%11101011           ; Encoder inputs on B5-3
    IOCBN = %00101000          ;enable ioc falling edge b3,b5
    ch var byte
    BUFF VAR BYTE [10]
     ;DEFINES FOR DISPLAY   use   font7x5_16.bas   or  font7x5_18.bas     for pic18
     #DEFINE PIC16 1            
     #define use_mssp 1   ; much faster and less words (1027 vs 1106).
     lcdheight con 5      ;  6 PAGES   
     lcdwidth  con 83     ; 84 PIXELS WIDE
     LCD_RST     var     LATA.4 
     LCD_DC      var     LATA.3
     LCD_CE      var     LATA.6
     LCD_LIGHT   var     LATA.0 
     ;LCD_CLK     var     LATB.4       ' SCK1     pin needs to be set as dig o/p
     ;LCD_DIN     var     LATB.2       ' SDO1     pin needs to be set as dig o/p
     ;--------------ONLY IF MSSP NOT USED---------------
    '
    Include "nokia_ds.INC"      ' bring it in
    include "font7x5_16.bas" 
    INCLUDE "DT_INTS-14.bas"    ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"    ' Include if using PBP type interrupts
    '
    ASM
    INT_LIST  macro    ; IntSource,         Label,  Type, ResetFlag?
            INT_Handler    IOC_INT,  _Rot_Encoder,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    @    INT_ENABLE   IOC_INT     ; Port Change Interrupt
    '==========================    MAIN  Routine    ==============================
        gosub lcd_init
        LCDCLR
        ARRAYWRITE BUFF,["READY",0]
        LCDSTR 5,0,BUFF 
        LCD_LIGHT  = 0    ' turn on backlight.
        PAUSE 1000
        LCDCLR
        PAUSE 1000  
    looper:
        LCDCLR
        
        bigtxt = 1     ; double size chrs
        LCDSTR 0,0,"Noki+12"
        LCDSTR 0,2,"345678@" 
        bigtxt = 0     ; normal size chrs
    '    LCDSTR 52,3,"Demo"
    '    LCDSTR 0,4,"With@MSSP xfer" 
        LCDSTR 0,4,"Hi" 
       
    '    LCDSTR 0,5,"Dble Size Chrs"     
    '    LCDSTR 0,5," "  ; this doesn't compile - causes errors and warnings wherever used.     
        LCDC 0,5,"a"    ; use LCDC for single chars.
        
        PAUSE 1000       
        GOTO looper
    Rot_Encoder:
       if IOCBF.3 then    LCD_LIGHT  = 0     ' Check if button was pushed.
       if IOCBF.5 then    LCD_LIGHT  = 1
       IOCBF=0 
    @ INT_RETURN                   ; Exit accordingly.
    '    endif
    END
    Warning I'm not a teacher

  2. #42
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    include order does not seem to matter [as I hoped]
    INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas" ' Include if using PBP type interrupts
    Include "nokia_ds.INC" ' bring it in
    include "font7x5_16.bas"
    works fine
    Warning I'm not a teacher

  3. #43
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    a version with fonts of user defined size

    this has a 14x10 font for two char 0,1 ie 2 rows 10 columns


    fonts now have a header added to define rows/columns first chr and last chr

    eg


    Code:
    #asm
    psect FONT_table,class=CODE,local,delta=2
      GLOBAL _FNT
    _FNT
            DW 0X0501, 0X207F  //1 ROW 5 COL CHR 32-127
            DW 0x0000, 0x0000, 0x0000, 0x005F, 0x0000 //  32 ' '  '!'
            DW 0x0007, 0x0007, 0x0014, 0x3F94, 0x3F94 //  34 '"'  '#'
            DW 0x122A, 0x3FAA, 0x0923, 0x0988, 0x3262 //  36 '$'  '%'
           ...............................

    Code:
    /**
     
            Product Revision  :  PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2
            Device            :  PIC16F1847
            Driver Version    :  2.00
     * font.c included via ide source files
     */
    #include "mcc_generated_files/mcc.h"
    void putwreg(char work);
    void putcmd(char x);
    void WrChar(char );
    void WrStr(const char *);
    void set_fnt(const char *);
    extern const char FNT,NUM;
    uint16_t fnt_addr;
    char fnt_row,fnt_col,fnt_fc,fnt_lc,POSX,POSY;
    void main(void) {
        // initialize the device
        SYSTEM_Initialize();
        set_fnt(&FNT);
        
        /*                                                                   *
         *  initialize Nokia 5110 LCD display                                *
         *                                                                   */
        __delay_ms(30); //
        LCD_RST_SetLow(); // 5110 'reset' pulse
        __delay_ms(1);
        LCD_RST_SetHigh(); // 5110 'reset' pulse
        __delay_ms(1);
        putcmd(0x20 + 0x01); // function set: extended instructions
        putcmd(0xc8); // set Vop (contrast), 0..127
        putcmd(0x04 + 0x02); // set temperature coefficient, 0..3
        putcmd(0x10 + 0x03); // Set bias system, 0..7
        putcmd(0x20 + 0x00); // function set: standard instructions
        putcmd(0x08 + 0x04); // display control: normal mode
        putcmd(0x80 + 0x20); // set DDRAM X address, 0..83
        putcmd(0x40 + 0x02); // set DDRAM Y address, 0..5
        POSX=32;
        POSY=2;
        WrChar('R'); // write ascii character
        WrStr("eady");
        
        set_fnt(&NUM);
        putcmd(0x80 + 0x10); // set DDRAM X address, 0..83
        putcmd(0x40 + 0x04); // set DDRAM Y address, 0..5
        POSX=16;
        POSY=5;
        WrChar('0'); // write ascii character
        WrChar('1'); // write ascii character
        
        while (1) {
        }
    }
    /**
     End of File
     */
    void set_fnt(const char *F){
        uint16_t tmp;
        fnt_addr=(uint16_t)F&0x1fff;
        tmp=FLASH_ReadWord(fnt_addr++);
        fnt_row = (char)tmp;
        fnt_col = tmp>>8;
        tmp=FLASH_ReadWord(fnt_addr++);
        fnt_lc = (char)tmp;
        fnt_fc = tmp>>8;
    }
    
    void putwreg(char work) // send byte, msb first (15 words)
    {
        LCD_CE_LAT = 0; // spi enable on
        SPI1_Exchange8bit(work);
        LCD_CE_LAT = 1; // spi enable off
    } //
    void WrChar(char d) { // for packed 2.5 word 5x7 font
        uint16_t tmp, inx = fnt_addr;
        char fd[32], i = fnt_row, j = 0, k, *pt;
        if ((d < fnt_fc) || (d > fnt_lc))return;
        inx += ((d - fnt_fc) * fnt_col*fnt_row) >> 1;
        while (i--) {
            k = fnt_col >> 1;
            if (k == 2)k++;
            while (k--) {
                tmp = FLASH_ReadWord(inx++);
                if (!i)
                    fd[j + 1] = ((char)tmp & 0x7f) ;//<< 1
                else
                    fd[j + 1] = ((tmp & 0x7f)<<1)&0xfe;
                tmp <<= 1;
                if (!i)
                    fd[j] = (tmp >> 8)& 0x7f;
                else
                    fd[j] = (tmp >> 7)& 0xfe;;
                j += 2;
                
            }
        }
        pt = fd;
        if ((d & 1)&&(fnt_col == 5))pt++;
        i = fnt_row;
        while (i--) {
            k = fnt_col;
            putcmd(0x40 +POSY-i);
            if(!i){
                 putcmd(0x80 +POSX);
                 
            }
            // with font now stored in bufer fd its easy to have large and/or inverted text
            while (k--) {
                putwreg(*pt++);
            }
            putwreg(0);
        }
        
        POSX+=fnt_col+1;
    }
    void putcmd(char x) {
        LCD_DC_SetLow();
        putwreg(x);
        LCD_DC_SetHigh();
    }
    void WrStr(const char *buff) {
        { //
            while (*buff)
                WrChar(*buff++); //
        }
    }
    #asm
    psect nums_table,class=CODE,local,delta=2
    _NUM
            DW 0X0A02, 0X3031  //2 ROW 10 COL CHR 0,1
            DW 15998, 899 ,8691, 15775 ,16252     // chr 0x30 " 0 "
            DW 4031, 15486, 14307, 12400, 8095
            DW 0, 518, 16383, 0, 0                         // chr 0x31 " 1 "
            DW 64 ,8288 ,16383 ,12352, 8192
    Last edited by richard; - 28th May 2018 at 05:52.
    Warning I'm not a teacher

  4. #44
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    some pics of the big fnt
    Attached Images Attached Images   
    Warning I'm not a teacher

  5. #45
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Nice work, Richard. This stuff is addicting...

    I worked through my problems with XC8 and have put aside the "minimal overhead" 5x7 project for now (stopping at 370 words total). Now I'm lookin' at bigger fonts, too, and a driver that can use an hpos (0..83) and vpos (0..47) starting point for drawing characters.

    I looked at someone's 11x16 font (below left) but I don't like it as much as a 10x14 font from Noritake-Itron (below right). I think I'd like to use the Noritake font as a starting point and reduce the character size slightly to allow for descenders on a few select lower case characters.

    Take care... Have fun... Regards, Mike
    Attached Images Attached Images   
    Last edited by Mike, K8LH; - 28th May 2018 at 19:45.

  6. #46
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Quote Originally Posted by richard View Post
    some pics of the big fnt
    May I ask for that magic excel file please?

    Ioannis

  7. #47
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    May I ask for that magic excel file please?
    all the magic is done with conditional formatting , a 1 in a field turns it black ,an empty field is blank
    make sure no field is greater than 1 or the math is incorrect

    complete number font
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by richard; - 29th May 2018 at 01:05.
    Warning I'm not a teacher

  8. #48
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Great work Richard, I hope Mike has success also we can learn from.

    Speaking of... will there be a PBP version arriving anytime soon? Knowing zero languages other than PBP (and I'm still an infant here) I marvel at what you experts can achieve and am quite envious

    Kind regards,
    Bill

    PS
    no time at present to test your reply to my last problem, hopefully the weekend will allow.

  9. #49
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    will there be a PBP version arriving anytime soon?
    don't hold your breath , since pbp has no pointer variable type its a bit tedious to code

    and a driver that can use an hpos (0..83) and vpos (0..47) starting point for drawing characters.
    maybe ART will grace us with some of his framebuffer code , I think a 504 byte buffer is not out of the question on a 16f1847
    Warning I'm not a teacher

  10. #50
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    latest iteration
    frame buffer, bitmap graphics, left/right scrolling, text at any x,y offset
    Attached Images Attached Images  
    Attached Files Attached Files
    Warning I'm not a teacher

  11. #51
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Quote Originally Posted by richard View Post
    all the magic is done with conditional formatting , a 1 in a field turns it black ,an empty field is blank
    make sure no field is greater than 1 or the math is incorrect

    complete number font
    Great! Never thought of that!

    Thanks Richard.
    Ioannis

  12. #52
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Nice work, Richard. Bravo!

    I finally imported that Noritake 10x14 Font into Excel today. It took a bit of work. The Noritake Font file was 1920 separate "retlw 0x00" type lines. Not an ideal format for importing into Excel so I wrote a quick JustBASIC program to generate 96 lines with 10 comma separated words per line. After importing that file into Excel I discovered that Noritake maps the b15 bit to row 0 with the b0 bit all the way down at row 15 so I modified my JustBASIC program to exchange the bit order and finally got the Font into Excel. Whew!

    Name:  Font Viewer 10x14 (small).png
Views: 2131
Size:  151.7 KB

    Code:
    '
    '  Noritake 10x14 Font Table Converter    30-May-2018, Mike McLaren
    '
    '  Reads the 1920 line one-hex-byte-at-a-time Noritake Font file and
    '  reformats it as 96 lines (one line per character), 10-words-per-line,
    '  reversed bit order (row 0 = bit 0), and as CSV text for Excel import.
    '  Does not alter the source file.
    '
    '  Instructions
    '
    '  1 - select the Noritake 10x14 text file from the File Dialog
    '  2 - output text displayed in console window
    '  3 - select text and copy to clipboard using <ctrl-C> or <edit> <copy>
    '  4 - paste into your spreadsheet (use text import tool)
    '
    '  JustBASIC v1.01
    '
    
       filedialog "Source File?", "*.txt", fileName$            '
       output$ = "hex"                                          ' select "dec" or "hex"
       if fileName$ <> "" then                                  '
         open fileName$ for input as #f                         '
         while eof(#f) > -1                                     '
           for asciichar = 32 to 127                            ' 96 characters (32..127)
             for n = 1 to 10                                    ' 10 words per line
             '
             ' read in an MSB and an LSB line ('       retlw   0x00') and turn them into
             ' a single decimal or hexidecimal word ('0x0000' or '00000') with a comma
             ' delimiter for CSV (comma separated value) import into Excel.
             '
               line input #f, aLine$: line input #f, bLine$     '
             '
             ' reverse bit order...  Noritake uses row 0 = b15 but we want row 0 = b0
             '
               dec = hexdec(aLine$+right$(bLine$,2))            ' convert hex to decimal
               dec = xcgbits(dec)                               ' exchange bit order
             '
               if (output$ = "dec") then                        ' if "dec" output
                 if (dec < 10000) then print " ";               ' print "dec" value
                 if (dec < 1000) then print " ";                '  "
                 if (dec < 100) then print " ";                 '  "
                 if (dec < 10) then print " ";                  '  "
                 print dec;                                     '  "
               else                                             ' else
                 print "0x";                                    ' print "hex" value
                 print dechex$(dec);                            '  "
               end if                                           '
               print ", ";                                      ' print separator
               if (n = 10) then                                 ' if last word in line
                 if (asciichar < 100) then print " ";           ' print ascii, 32..127
                 print asciichar;: print " ";                   '  "
                 print "'";:print chr$(asciichar);: print "'"   ' print ascii character
               end if                                           '
    
             next n
           next asciichar                                       ' next character line
           print                                                '
         wend
         close #f
       end if
    
       end
    
    '
    ' Converts hexadecimal number (string) to decimal number.
    ' Processes the hex number from right to left, so any hex notation is allowed.
    ' Examples: &hFF = 0xFF = FF
    '
    function hexdec(HexString$)
      Hex$ = "0123456789ABCDEF"
      power = 0
      hexdec = 0
    
      for i = len(HexString$) to 1 step -1
        HexDigit$ = upper$(mid$(HexString$, i, 1))
      '
      ' exit at first non-hexadecimal digit
      '
        if instr(Hex$, HexDigit$) = 0 then exit for
        hexdec = hexdec + ((instr(Hex$, HexDigit$) - 1) * (16^power))
        power = power + 1
      next
    end function
    
    '
    ' convert decimal number to 4-digit hexidecimal string
    '
    function dechex$(DecValue)
      Hex$ = "0123456789ABCDEF"
      dechex$ = ""
      for power = 3 to 0 step -1
        digitndx = int(DecValue/16^power)
        DecValue = DecValue - digitndx*16^power
        dechex$ = dechex$ + mid$(Hex$,digitndx+1,1)
      next power
    end function
    
    '
    ' exchange bit order b15<>b0, b14<>b1, b13<>b2, ...
    '
    function xcgbits(decval)
      xcgbits = 0
      newpwr = 0
      for power = 15 to 0 step -1
        if (decval >= 2^power) then
          decval = decval - 2^power
          xcgbits = xcgbits + 2^newpwr
        end if
        newpwr = newpwr + 1
      next power
    end function
    If you need it, here's the converted "decimal" version of the Noritake 10x14 Font in CSV format for Excel;

    Code:
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,  32 ' '
        0,     0,     0,     0, 13311, 13311,     0,     0,     0,     0,  33 '!'
        0,     0,    15,    15,     0,     0,    15,    15,     0,     0,  34 '"'
      816,   816, 16383, 16383,   816,   816, 16383, 16383,   816,   816,  35 '#'
     1584,  3704,  3324,  3276, 16383, 16383,  3276,  4044,  1948,   792,  36 '$'
        6, 12303, 15375,  3846,   960,   240,  6204, 15375, 15363,  6144,  37 '%'
     3900,  8190, 14531, 12771, 13299, 14139,  7710,  3084, 16128, 13056,  38 '&'
        0,     0,     0,    34,    55,    31,    14,     0,     0,     0,  39 '''
        0,     0,  1008,  4092,  7710,  6150, 12291, 12291,     0,     0,  40 '('
        0,     0, 12291, 12291,  6150,  7710,  4092,  1008,     0,     0,  41 ')'
     1584,  1904,   992,   448,  8188,  8188,   448,   992,  1904,  1584,  42 '*'
      192,   192,   192,   192,  4092,  4092,   192,   192,   192,   192,  43 '+'
     8704, 14080,  7936,  3584,     0,     0,     0,     0,     0,     0,  44 ','
      192,   192,   192,   192,   192,   192,   192,   192,   192,   192,  45 '-'
     6144, 15360, 15360,  6144,     0,     0,     0,     0,     0,     0,  46 '.'
        0, 12288, 15360,  3840,   960,   240,    60,    15,     3,     0,  47 '/'
     4092,  8190, 16135, 13187, 12739, 12515, 12403, 14399,  8190,  4092,  48 '0'
        0,     0, 12300, 12302, 16383, 16383, 12288, 12288,     0,     0,  49 '1'
    12300, 14350, 15367, 15875, 14083, 13187, 12739, 12519, 12414, 12348,  50 '2'
     3084,  7182, 14343, 12291, 12291, 12483, 12483, 14535,  8190,  3900,  51 '3'
      960,   992,   880,   824,   796,   782, 16383, 16383,   768,   768,  52 '4'
     3135,  7231, 14387, 12339, 12339, 12339, 12339, 14451,  8163,  4035,  53 '5'
     4092,  8190, 14535, 12483, 12483, 12483, 12483, 14791,  8078,  3852,  54 '6'
        3,     3,     3,     3, 16323, 16355,   115,    59,    31,    15,  55 '7'
     3900,  8190, 14823, 12483, 12483, 12483, 12483, 14823,  8190,  3900,  56 '8'
       60,   126, 12519, 12483, 14531,  7363,  3779,  2023,  1022,   508,  57 '9'
        0,     0,     0,  1560,  3900,  3900,  1560,     0,     0,     0,  58 ':'
        0,     0,     0,  8728, 14140,  7996,  3608,     0,     0,     0,  59 ';'
        0,   192,   480,  1008,  1848,  3612,  7182, 14343, 12291,     0,  60 '<'
      816,   816,   816,   816,   816,   816,   816,   816,   816,   816,  61 '='
        0, 12291, 14343,  7182,  3612,  1848,  1008,   480,   192,     0,  62 '>'
       12,    14,     7,     3, 14211, 14275,   195,   103,   126,    60,  63 '?'
     3852,  8078, 14791, 12483, 16323, 16323, 12291, 14343,  8190,  4092,  64 '@'
    16380, 16382,   775,   771,   771,   771,   771,   775, 16382, 16380,  65 'A'
    16383, 16383, 12483, 12483, 12483, 12483, 12483, 14823,  8190,  3900,  66 'B'
     4092,  8190, 14343, 12291, 12291, 12291, 12291, 14343,  7182,  3084,  67 'C'
    16383, 16383, 12291, 12291, 12291, 12291, 12291, 14343,  8190,  4092,  68 'D'
    16383, 16383, 12483, 12483, 12483, 12483, 12483, 12483, 12291, 12291,  69 'E'
    16383, 16383,   195,   195,   195,   195,   195,   195,     3,     3,  70 'F'
     4092,  8190, 14343, 12291, 12291, 12483, 12483, 14535,  8142,  4044,  71 'G'
    16383, 16383,   192,   192,   192,   192,   192,   192, 16383, 16383,  72 'H'
        0,     0, 12291, 12291, 16383, 16383, 12291, 12291,     0,     0,  73 'I'
     3072,  7168, 14339, 12291, 12291, 14339,  8191,  4095,     3,     3,  74 'J'
    16383, 16383,   480,   480,  1008,  1848,  3612,  7182, 14343, 12291,  75 'K'
    16383, 16383, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288,  76 'L'
    16383, 16383,    14,    28,   248,   248,    28,    14, 16383, 16383,  77 'M'
    16383, 16383,    56,   112,   224,   448,   896,  1792, 16383, 16383,  78 'N'
     4092,  8190, 14343, 12291, 12291, 12291, 12291, 14343,  8190,  4092,  79 'O'
    16383, 16383,   195,   195,   195,   195,   195,   231,   126,    60,  80 'P'
     4092,  8190, 14343, 12291, 13059, 14083, 15875,  7175, 16382, 14332,  81 'Q'
    16383, 16383,   195,   451,   451,   963,   963,  3815, 15486, 14396,  82 'R'
     6204, 14462, 12519, 12483, 12483, 12483, 12483, 14787,  8071,  3846,  83 'S'
        3,     3,     3,     3, 16383, 16383,     3,     3,     3,     3,  84 'T'
     4095,  8191, 14336, 12288, 12288, 12288, 12288, 14336,  8191,  4095,  85 'U'
     1023,  2047,  3584,  7168, 14336, 14336,  7168,  3584,  2047,  1023,  86 'V'
     4095,  8191, 14336, 15360,  7936,  7936, 15360, 14336,  8191,  4095,  87 'W'
    15375, 15903,  1848,  1008,   480,   480,  1008,  1848, 15903, 15375,  88 'X'
       63,   127,   224,   448, 16256, 16256,   448,   224,   127,    63,  89 'Y'
    15363, 15875, 14083, 13187, 12739, 12515, 12403, 12347, 12319, 12303,  90 'Z'
        0,     0, 16383, 16383, 12291, 12291, 12291,     0,     0,     0,  91 '['
       12,    12,    48,    48,   192,   192,   768,   768,  3072,  3072,  92 '\'
        0,     0, 12291, 12291, 12291, 16383, 16383,     0,     0,     0,  93 ']'
       48,    56,    28,    14,     7,     7,    14,    28,    56,    48,  94 '^'
    12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288,  95 '_'
        0,     0,     3,     7,    14,    28,    24,     0,     0,     0,  96 '`'
     3072,  7776, 16240, 13104, 13104, 13104, 13104, 13168, 16352,  8128,  97 'a'
    16383, 16383, 12480, 12480, 12480, 12480, 12480, 14784,  8064,  3840,  98 'b'
     4032,  8160, 14448, 12336, 12336, 12336, 12336, 14448,  7392,  3264,  99 'c'
     3840,  8064, 14784, 12480, 12480, 12480, 12480, 12480, 16383, 16383, 100 'd'
     4032,  8160, 15216, 13104, 13104, 13104, 13104, 15216,  7136,  2496, 101 'e'
        0,   192, 16380, 16382,   199,   199,    14,    12,     0,     0, 102 'f'
     6336, 14816, 13296, 13104, 13104, 13104, 13104, 15152,  8176,  4064, 103 'g'
    16383, 16383,   192,   192,   192,   192,   448, 16256, 16128,     0, 104 'h'
        0,     0,     0,     0, 16344, 16344,     0,     0,     0,     0, 105 'i'
        0,  3072,  7168, 14336, 12288, 12288, 14336,  8179,  4083,     0, 106 'j'
        0, 16383, 16383,  1792,  1920,  4032,  7392, 14448, 12336,     0, 107 'k'
        0,     0, 12291, 12291, 16383, 16383, 12288, 12288,     0,     0, 108 'l'
    16368, 16368,   112,   224,   960,   960,   224,   112, 16368, 16368, 109 'm'
    16368, 16368,   192,   224,   112,    48,    48,   112, 16352, 16320, 110 'n'
     4032,  8160, 14448, 12336, 12336, 12336, 12336, 14448,  8160,  4032, 111 'o'
    16368, 16368,   816,   816,   816,   816,   816,  1008,   480,   192, 112 'p'
      192,   480,  1008,   816,   816,   816,   816,   816, 16368, 16368, 113 'q'
    16368, 16368,   448,   224,   112,    48,    48,   112,   224,   192, 114 'r'
     6336, 14816, 13296, 13104, 13104, 13104, 13104, 16176,  7792,  3168, 115 's'
        0,    48,    48,  4095,  8191, 14384, 14384,  7216,  3120,     0, 116 't'
     4080,  8176, 14336, 12288, 12288, 12288, 12288, 14336,  8176,  4080, 117 'u'
     1008,  2032,  3584,  7168, 14336, 14336,  7168,  3584,  2032,  1008, 118 'v'
     4080,  8176, 14336, 14336,  7936,  7936, 14336, 14336,  8176,  4080, 119 'w'
    12336, 14448,  7392,  4032,  1920,  1920,  4032,  7392, 14448, 12336, 120 'x'
       48,   112, 12512, 14784,  8064,  3968,   448,   224,   112,    48, 121 'y'
    12336, 14384, 15408, 15920, 14128, 13232, 12784, 12528, 12400, 12336, 122 'z'
        0,   192,   480,  4092,  7998, 14343, 12291, 12291, 12291,     0, 123 '{'
    12480, 12480, 16380, 16382, 12487, 12483, 12291, 12295, 12302, 12300, 124 '|'
        0, 12291, 12291, 12291, 14343,  7998,  4092,   480,   192,     0, 125 '}'
        3,     3,     3,     3,     3,     3,     3,     3,     3,     3, 126 '~'
    16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 127 ''
    Last edited by Mike, K8LH; - 31st May 2018 at 03:47.

  13. #53
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Richard, here's something fun... Someone over on the MrExcel forum helped me with a VBA macro that allows you to toggle the value in a cell within your 10x16 matrix between "null" and "1" by simply clicking on it. The attached file is your spreadsheet with macros enabled (xlsm rather than xlsx file extension). I'm not sure if you have to enable "developer" mode in Excel or not, but give it a try...

    Cheerful regards, Mike

    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'Modified 5/30/18 9:50 PM EDT
    If Not Intersect(Target, Range("B30:K45")) Is Nothing Then
      If Target.Cells.CountLarge > 1 Then Exit Sub
        If Target.Value = "1" Then
          Target.Value = ""
        Else
          Target.Value = "1"
      End If
      Range("b28").Select
    End If
    End Sub
    Attached Files Attached Files
    Last edited by Mike, K8LH; - 31st May 2018 at 06:05.

  14. #54
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    thanks mike , its just whats needed and works perfectlty
    Warning I'm not a teacher

  15. #55
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Ok, I'm almost ready to play with real hardware. I located my old 5110 display and an old 5110 test board that I had started to assemble (below). It looks like I need to solder a few wires onto the 8-pin 5110 connector. Maybe I can get this up-n'-runnin' this weekend...

    Are you running the PIC and 5110 display at 3.3 volts, Richard?
    Attached Images Attached Images  
    Last edited by Mike, K8LH; - 1st June 2018 at 15:31.

  16. #56
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Are you running the PIC and 5110 display at 3.3 volts,
    yes the contrast won't accommodate 5v for me.
    I still have a bug in the bitmap routine, but my eldest son is getting married tomorrow so I have to play
    happy families
    Warning I'm not a teacher

  17. #57
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Congratulations, Richard. Have fun tomorrow...

  18. #58
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    bug free {hopefully} version, with a few new functions [circle,rectangle,lines]
    Attached Files Attached Files
    Warning I'm not a teacher

  19. #59
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Hi Richard,

    I finally found some time to try your suggestions as shown in post #41 - it does not work for me.

    Copying and pasting your code, I had no display until changing TRISA from %10010000 to all outputs and even then no big characters were seen until DTints and associated parts were commented out. Order of Includes made no difference.

    There's still a problem with the backlighting as well because it initially is dim then changes to a short duration pulse of bright background coincident with each LCDCLR command. No difference whether displaying big characters or not wrt these bright flashes. When I add LCD_LIGHT = 1 in the mix I have no text displayed.

    Any suggestions where I should go to from here?

    Thanks and regards,
    Bill

  20. #60
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    I finally found some time to try your suggestions as shown in post #41 - it does not work for me
    Any suggestions where I should go to from here?
    my code as posted works perfectly for me , so I'm not sure what the problem is.

    if you post your latest code attempt and refresh my memory on how its connected I will have a look.
    Warning I'm not a teacher

  21. #61
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    I had no display until changing TRISA from %10010000 to all outputs
    correct I failed to make the LCD_RST pin an output , all the "LCD" pins need to be digital outputs.
    my code did not work after a power cycle , the disp was keeping its config from previous code so resets never happened
    it all looked good while the power was still applied.


    When I add LCD_LIGHT = 1 in the mix I have no text displayed.

    LCD_LIGHT = 1 is backlight off. LCD_LIGHT = 0 is backlight on
    if it does anything else then check your wiring , or it may be a power problem
    Warning I'm not a teacher

  22. #62
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    found a problem , the init subroutine needs to pause a bit after the rst pulse otherwise display may not initialise properly

    Code:
    lcd_init:
        @ GLetAddress _font7x5,_glcdFont
        bigtxt = 0
        inverted =0
        #ifdef use_mssp 
        SSP1CON1=$21  ;$22,21,20 all work @32mhz  20 is fastest 
        SSP1STAT=$40
        #endif
        LCD_CE=1 
        pause 30 
        Lcd_RST = 0         ' Reset LCD (HW reset)
        pause 1
        Lcd_RST = 1         ' Release Reset
        pause 1     ;add this pause
    '    lcd_dc=0
        LCDCMD   $21        ' LCD EXTENDED COMMANDS
        LCDCMD   $c8        ' SET LCD Vop (CONTRAST) initial value $C8 = 200.
        LCDCMD   $06        ' SET TEMP COEFFICIENT
        LCDCMD   $13        ' LCD BIAS MODE
        LCDCMD   $20        ' LCD STANDARD COMMANDS
        LCDCMD   $08        ' LCD blank
        LCDCMD   $0c        ' LCD IN NORMAL MODE
    return
    Warning I'm not a teacher

  23. #63
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    turns out that testing the bit vars "inverted" and "bigtext" was not always working after the asm section in gcga subroutine .this only shows up when some vars are pushed out of bank 0 .I can not establish the failure mechanism ,seems i'm just guessing what "CHK?RP" AND "RST?RP" macros actually do . I can't find their definitions anywhere . making the vars into bytes and manually setting correct bank fix the issue.
    here is a more complex demo and an amended nokia include file to test and overcome this issue
    Attached Files Attached Files
    Warning I'm not a teacher

  24. #64
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Hi Richard,

    I have compile errors with your new code, NB I've renamed them to NOKIA_DEMO#6 to avoid confusion with previous versions:
    [ERROR] nokia_demo#6.pbp (184) : Syntax error
    [ERROR] nokia_demo#6.pbp (195) : Syntax error
    [ERROR] nokia_demo#6.pbp (195) : Redefiniton of LABEL RJUSTBUFF

    which is:
    Code:
        RJUSTBUFF  buff,4        ;http://support.melabs.com/forum/picbasic-pro-compiler-3-0-and-later/usercommand/983-strtok-usercmd
        RJUSTBUFF  buff,2   ;http://support.melabs.com/forum/picbasic-pro-compiler-3-0-and-later/usercommand/983-strtok-usercmd
    What have I missed?

    Regards,
    Bill
    Attached Files Attached Files

  25. #65
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    What have I missed?
    you can't use my RJUSTBUFF user command unless you include the file that defines it .

    it can be found at the link in the comment ,its included with the strtok code


    http://support.melabs.com/forum/picb...strtok-usercmd
    Warning I'm not a teacher

  26. #66
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Hi Richard,

    Excellent work, thank you. I found my problem - the "strtok.pbpmod" Inc file I used was the older version, somehow I missed the update further down the page on that link.

    All works well, now I need to get my head around how you've performed the magic and modify the code to suit my layout and various pages of information shown on the Nokia display.

    Once again many thanks for the help, you are indeed an asset to the forum.

    Cheers,
    Bill

  27. #67
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    somehow I missed the update further down the page on that link.
    because I forgot to post it
    Warning I'm not a teacher

  28. #68
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Richard & gang... Just wanted to mention that my prototype board for the 5110 display works great and my "minimal" XC8 demo program ended up using 370 words of memory, including 240 words for the packed 5x7 font table.

    Also just got my little 128x32 SSD1306 I2C OLED display running with a 16F1823. Man, these OLED displays are really nice. A "bare bones" XC8 program + packed 5x7 font table uses 485 words of memory so a bit more 'overhead' for the low-level SSD1306 controller and I2C functions. However, the 2-pin interface more than makes up for the extra code (grin). Not sure how useful a 5x7 font will be on these little displays...

    Cheerful regards, Mike

    Name:  5110 #1.png
Views: 1687
Size:  536.6 KBName:  SSD1306 #1.jpg
Views: 1717
Size:  61.5 KB
    Last edited by Mike, K8LH; - 2nd July 2018 at 05:58.

  29. #69
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    well done mike
    have you tried your code on a pic18 yet ?
    I have come unstuck , can't stop xc8 either overwriting my font , or saying it won't fit or just deciding not to include it at all .
    wasted days on this . there must be a how to use psect manual somewhere
    Warning I'm not a teacher

  30. #70
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Is this a problem with PIC18 only, Richard? I haven't tried using a PSECT on PIC18, yet...

  31. #71
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    I'm working with a 18f25k22 and getting much grief getting a PSECT to work as intended .
    I could store the font as const unsigned int font [][3] { {0,0,0},{……}} but it would be nice to have an include that can be used in either
    pic16 or pic18 chips
    Warning I'm not a teacher

  32. #72
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Hi Richard.

    I threw a couple PSECT tables into an XC8 program for an 18F14K22 and when I look at the .LST file it seems XC8 is avoiding those tables just as it should.

    Code:
    /************************************************************************
     *   Digits '0' thru '9' of a 10x14 font                                *
     ************************************************************************/
       #asm
       PSECT my10x14, class=CODE, abs, ovrld, space=0, delta=2
         ORG 0x3E00
       Font10x14:
         dw 0x0FFC, 0x1FFE, 0x3F07, 0x3383, 0x31C3, 0x30E3, 0x3073, 0x383F, 0x1FFE, 0x0FFC  ;  48 '0'
         dw 0x0000, 0x0000, 0x300C, 0x300E, 0x3FFF, 0x3FFF, 0x3000, 0x3000, 0x0000, 0x0000  ;  49 '1'
         dw 0x300C, 0x380E, 0x3C07, 0x3E03, 0x3703, 0x3383, 0x31C3, 0x30E7, 0x307E, 0x303C  ;  50 '2'
         dw 0x0C0C, 0x1C0E, 0x3807, 0x3003, 0x3003, 0x30C3, 0x30C3, 0x38C7, 0x1FFE, 0x0F3C  ;  51 '3'
         dw 0x03C0, 0x03E0, 0x0370, 0x0338, 0x031C, 0x030E, 0x3FFF, 0x3FFF, 0x0300, 0x0300  ;  52 '4'
         dw 0x0C3F, 0x1C3F, 0x3833, 0x3033, 0x3033, 0x3033, 0x3033, 0x3873, 0x1FE3, 0x0FC3  ;  53 '5'
         dw 0x0FFC, 0x1FFE, 0x38C7, 0x30C3, 0x30C3, 0x30C3, 0x30C3, 0x39C7, 0x1F8E, 0x0F0C  ;  54 '6'
         dw 0x0003, 0x0003, 0x0003, 0x0003, 0x3FC3, 0x3FE3, 0x0073, 0x003B, 0x001F, 0x000F  ;  55 '7'
         dw 0x0F3C, 0x1FFE, 0x39E7, 0x30C3, 0x30C3, 0x30C3, 0x30C3, 0x39E7, 0x1FFE, 0x0F3C  ;  56 '8'
         dw 0x003C, 0x007E, 0x30E7, 0x30C3, 0x38C3, 0x1CC3, 0x0EC3, 0x07E7, 0x03FE, 0x01FC  ;  57 '9'
       #endasm
    
    /************************************************************************
     *   Packed 96 character 5x7 Font, 2.5-words-per-character, 240 words   *
     ************************************************************************/
       #asm
       PSECT myFonts, class=CODE, abs, ovrld, space=0, delta=2
         ORG 0x3F00
       Font5x7:
    Last edited by Mike, K8LH; - 4th July 2018 at 01:01.

  33. #73
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    extract from .lst , it all looks good yet the font is not there.

    Code:
     114                           	psect	text
       115  3E00                     	org	15872	;# 
       116  3E00                     
       117                           ;# 
       118  3E00  0501 207F          	dw	1281,8319	;# 
       119  3E02  0000 0000 0000 005F 0000 	dw	0,0,0,95,0	;# 
       120  3E07  0007 0007 0014 3F94 3F94 	dw	7,7,20,16276,16276	;# 
       121  3E0C  122A 3FAA 0923 0988 3262 	dw	4650,16298,2339,2440,12898	;# 
       122  3E11  1B49 2AA2 2800 0283 0000 	dw	6985,10914,10240,643,0	;# 
       123  3E16  001C 1141 0000 20A2 0E00 	dw	28,4417,0,8354,3584	;# 
       124  3E1B  0A08 1F08 0A08 043E 0408 	dw	2568,7944,2568,1086,1032	;# 
       125  3E20  0050 1800 0008 0408 0408 	dw	80,6144,8,1032,1032	;# 
       126  3E25  0060 3000 0020 0808 0202 	dw	96,12288,32,2056,514	;#
    Attached Images Attached Images  
    Warning I'm not a teacher

  34. #74
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    That's wierd. The tables show up in the LST file and in the HEX file but not in the Program Memory window...

    Ok, section 6.2.9.3.4 in the XC8 User's Guide describes the PSECT "delta" parameter and as soon as I changed the parameters from "delta=2" to "delta=1" my two font tables showed up in the Program Memory window and my TBLPTR test code started working correctly in the simulator... Whew!
    Last edited by Mike, K8LH; - 4th July 2018 at 07:26.

  35. #75
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    test code started working correctly in the simulator... Whew!
    I agree , you would think writing word sized data would need delta=2.

    my brain hurts but it solves the problem , thanks mike
    Warning I'm not a teacher

  36. #76
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    You're very welcome, Sir. And thank you for all the help and hard work you've provided.

    BTW, I'm liking this 128x32 I2C SSD1306 OLED display a lot... With built-in RAM for a 128x64 display, you can basically have two display screens. You can write data to one screen while displaying the other then toggle the display screen. Should make easy work for cursor characters, flashing colon characters for a clock, or displaying "odometer" type sliding numbers.
    Attached Images Attached Images  

  37. #77
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    This thread is being here for couple of years.

    Thanks those guys which spent their time for this really nice work.

    I'm trying to find a way to combine this low cost nokia lcd display to heart rate monitor project with MAX30102.

    Has anyone tried the code with PIC18F?

    I tried the first demo code and it looks like is working.

    Then i tried the code given in #36 , (Richard shared once again) and i cant make it work. It was late at night and i tired enouph to check if i have set everything as required.

    I will give it a go today again.

    If there is a new version for pic18f's will be nice if anyone could share it.

    Many thanks in advance.

  38. #78
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    looks like i made a later version , did not try it with a pic18 but the code is written to use either 16's or 18's
    pic18 probably needs the pic18 version of the font
    Attached Files Attached Files
    Warning I'm not a teacher

  39. #79
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Hi Richard,

    thanks for the updated files.

    I have tried the new inc and got the following errors. (used PIC18f46k22)

    Is there a way i could fix those?

    Name:  error.png
Views: 1477
Size:  15.8 KB

  40. #80
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Nokia lcd include , small footprint to suit pic16's

    Does it matter that SFR are commented in the pic18f46k22 pbpinc?

    Name:  sfr.png
Views: 1452
Size:  25.9 KB

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 05:47
  2. 16F946 pcb footprint (64 tqfp)
    By nomad in forum Schematics
    Replies: 2
    Last Post: - 8th September 2009, 12:14
  3. small 2X16 LCD
    By Ron Marcus in forum Off Topic
    Replies: 2
    Last Post: - 26th October 2007, 21:37
  4. Nokia 3310 LCD
    By barkerben in forum General
    Replies: 3
    Last Post: - 10th December 2005, 20:08
  5. Small LCD module,character
    By Ron Marcus in forum Off Topic
    Replies: 6
    Last Post: - 27th November 2005, 19:13

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts