+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 41 to 67 of 67
  1. #41
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

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

    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
    This is more entertaining than Free to Air TV

  3. #43
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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 04:52.
    This is more entertaining than Free to Air TV

  4. #44
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

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

    some pics of the big fnt
    Attached Images Attached Images   
    This is more entertaining than Free to Air TV

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

    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 18:45.

  6. #46
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,700

    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
    1,388

    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 00:05.
    This is more entertaining than Free to Air TV

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

    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
    1,388

    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
    This is more entertaining than Free to Air TV

  10. #50
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

  11. #51
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,700

    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
    204

    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: 94
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 02:47.

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

    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 05:05.

  14. #54
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

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

    thanks mike , its just whats needed and works perfectlty
    This is more entertaining than Free to Air TV

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

    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 14:31.

  16. #56
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

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

    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
    1,388

    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
    This is more entertaining than Free to Air TV

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

    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
    1,388

    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.
    This is more entertaining than Free to Air TV

  21. #61
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

  22. #62
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

  23. #63
    Join Date
    May 2013
    Location
    australia
    Posts
    1,388

    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
    This is more entertaining than Free to Air TV

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

    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
    1,388

    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
    This is more entertaining than Free to Air TV

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

    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
    1,388

    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
    This is more entertaining than Free to Air TV

Similar Threads

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

Members who have read this thread : 27

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