Menu

Nokia 3110 GLCD display driver - PCD8544

Anobium
2014-10-20
2014-10-21
  • Anobium

    Anobium - 2014-10-20

    Just released a Nokia 3110 GLCD display driver using the PCD8544.

    The GLCD.h driver for the Nokia 3110 PCD8544 supports two modes of operation.
    1 - Full support for BMP's, text (all pixels addressable) , line, box, circle etc. Requires large RAM 16f devices of 1024 bytes, or AVR or 18F. This method uses page buffering hence the need for the RAM.
    2 - Support for BMP's and text only 13 * 7 characters only. No page buffering.

    The command set is the standard GLCD command set. See code below and the attachment for an example.

    Have fun,

    Anobium

     

    Last edit: Anobium 2014-10-22
    • Anobium

      Anobium - 2014-10-20

      Thanks and Youtube.

      • My thanks go to Hugh! He provided the method of creating a large scale RAM buffer for the 16f devices! Thank you.

      • The GLCD demo, see http://youtu.be/nohcIHt6Pkw

       
  • Anobium

    Anobium - 2014-10-20

    An example using the Chipino.

    ~~~~~
    '
    'This program was written using the Great Cow Basic IDE for use with the PIC
    'Microchio development board and a Nokia 3310 LCD. It is a nice small graphical LCD, suitable for a lot of various projects.
    'The display is 3835 mm, with an active display surface of 3022 mm, and a 84*48 pixel resolution.
    'The display is easy to interface, using an SPI type of communication.
    'A 1-10 uF electrolytic capacitor from VOUT to GND, is the only external component needed on to display connection 7
    ' Display connection 1 = 3.3v
    ' Display connection 6 = 0v
    ' Display connection 7 = 4.7uf CAP
    '
    'You may copy, alter and reuse this code in any way you like, but please leave
    'reference to Great Cow Basic and Anobium in your comments if you redistribute this code. '
    'THIS SOFTWARE IS PROVIDED "AS IS". WE MAKE, OR PROVIDE, ANY WARRANTIES,
    'WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED
    'WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR
    'LACK OF NEGLIGENCE. ANOBIUM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
    'FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR
    'CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.

    #chip 16f1938,32
    #config Osc = INT, VCAPEN_OFF, MCLRE_ON, PLLEN_ON, CLKOUTEN_OFF
    #include <glcd.h>
    #include <chipino.h>
    #define GLCD_LAT

    #DEFINE GLCD_TYPE GLCD_TYPE_PCD8544

      #define GLCD_WIDTH 84
      #define GLCD_HEIGHT 48
    
      ' For devices with limited RAM you can use Character and Picture mode (no lines, circles etc.
      ' Remove the arrays above and remove the remarks from the two defines below
    

    ' #define GLCD_TYPE_PCD8544_CHARACTER_MODE_ONLY

      'Pin mappings for Nokia 3310 Device for CHIPINO
      #define GLCD_DC         D5          ' to display connection 4
      #define GLCD_CS         D6          ' to display connection 5
      #define GLCD_RESET      D7          ' to display connection 8
      #define GLCD_DO         D2          ' to display connection 3
      #define GLCD_SCK        D4          ' to display connection 2
    
      #define _GLCD_DC        _D5         ' LAT addresses
      #define _GLCD_CS        _D6
      #define _GLCD_RESET     _D7
      #define _GLCD_DO        _D2         
      #define _GLCD_SCK       _D4
    

    'main program

    do forever
    
        dim lengthofpicture, ram_index as word
    
        ' Display a BMP
        GLCDCLS
        ReadTable Anobium84_48, 0, lengthofpicture
        for  ram_index =  0 to lengthofpicture-1
                  ReadTable Anobium84_48,  (ram_index+1), byteval
                  PCD8544_Write_Data(byteval)
        next
        wait 2 s
    
        ' Display a nice message
        GLCDCLS
        GLCDPrint(0,0,"Welcome!!")
        GLCDPrint(0,16,"GCB Compiler")
        GLCDPrint(0,24,"Nokia 3110 LCD")
        GLCDPrint(0,32,"October 2014")
        wait 2 s
    
        ' Display some graphics with text overalay
        GLCDCLS
        line 0,0,83,47
        line 0,47,83,0
        Circle(42,24,12,1)            ;center
        FilledCircle(42,24,8,1)       ;center
        Circle(70,24,8,1)             ;mid right
        box (0,0,83,47)
        filledbox (10,20,20,30,1)
        GLCDPrint 10,1, "ChipMhz@"
        GLCDPrint 60, 1, str(ChipMhz)
        GLCDPrint 18,37, ChipNameStr
        for char = 15 to 129            'Print character set
                GLCDdrawCHAR 67,19, char
                wait 125 ms
        next
        wait 2 s
    
    loop
    

    end

    ' Valid BMP file found
    ' BMP Metrics
    ' BMP Magic Number = BM, Width < 129, Height < 65, CompressionType = 0 & BitsPerPixel = 1
    ' BMP MagicNumber = BM
    ' BMP Width = 84
    ' BMP Height = 48
    ' BMP CompressionType = 0
    ' BMP BitsPerPixel = 1
    ' Completed Examination of BMP file
    ' ------------------------------------------------------------------------------
    ' File generated by BMP2GCB
    ' See http://sourceforge.net/projects/bmptoglcd/

    Table Anobium84_48 as Byte

    ' start data
    0x54
    0x30
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x80
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x80
    0xF0
    0x9C
    0xE7
    0x38
    0x0E
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x02
    0x06
    0x0D
    0x0B
    0x1E
    0x34
    0x68
    0xD8
    0xF0
    0x60
    0xC0
    0x80
    0x80
    0x80
    0xC0
    0xC0
    0x40
    0x40
    0x60
    0x60
    0x60
    0x20
    0x20
    0x20
    0x30
    0x30
    0x10
    0x10
    0x10
    0x18
    0x18
    0x08
    0x0E
    0x1B
    0x7E
    0xE3
    0x80
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0xC0
    0x20
    0xC0
    0x00
    0x00
    0x01
    0x7F
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0xE0
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x20
    0x00
    0x03
    0x07
    0x0C
    0x08
    0x30
    0x60
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0xC0
    0x38
    0x16
    0x11
    0x10
    0x11
    0x16
    0x38
    0xC0
    0x00
    0xFF
    0x02
    0x01
    0x01
    0x01
    0xFE
    0x00
    0x00
    0x7E
    0x81
    0x81
    0x81
    0x81
    0x7E
    0x00
    0x00
    0xFF
    0x42
    0x81
    0x81
    0x81
    0x7E
    0x00
    0x00
    0xFF
    0x00
    0x00
    0x7F
    0x80
    0x80
    0x80
    0x40
    0xFF
    0x00
    0x00
    0xFF
    0x02
    0x01
    0x01
    0x01
    0xFE
    0x02
    0x01
    0x01
    0x01
    0xFE
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x3E
    0x60
    0x40
    0xC0
    0x80
    0x80
    0x80
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x80
    0xC0
    0xE0
    0x70
    0x18
    0x0C
    0x06
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x01
    0x01
    0x01
    0x03
    0x02
    0x06
    0x06
    0x04
    0x0C
    0x08
    0x18
    0x18
    0x10
    0x30
    0x20
    0x60
    0x60
    0x40
    0x60
    0x30
    0x18
    0x0C
    0x06
    0x03
    0x01
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00
    End Table

     

    Last edit: Anobium 2014-10-22
  • Anobium

    Anobium - 2014-10-21
        #DEFINE GLCD_TYPE GLCD_TYPE_PCD8544
        #define GLCD_WIDTH 84
        #define GLCD_HEIGHT 48
    
        ' For devices with limited RAM you can use Character and Picture mode (no lines, circles etc.
        ' Remove the remark from the define below:
    
        ' #define GLCD_TYPE_PCD8544_CHARACTER_MODE_ONLY
    
        ' Comment out following paragraph for a non LAT port configuration and for ATMEL etc. devices.
         #define GLCD_LAT
    
         ' Pin mappings for Nokia 3310 Device please use LAT and Port definitions as appropiate
              #define GLCD_DO latc.5
              #define GLCD_SCK latc.3
              #define GLCD_DC latc.2
              #define GLCD_CS latc.1
              #define GLCD_RESET latc.0
    
              #define _GLCD_DO portc.5
              #define _GLCD_SCK portc.3
              #define _GLCD_DC portc.2
              #define _GLCD_CS portc.1
              #define _GLCD_RESET portc.0
    
          ' Pin mappings for SPI for Nokia 3310 Device
          ' None LAT configurations
    '          #define GLCD_DO portc.5
    '          #define GLCD_SCK portc.3
    '          #define GLCD_DC portc.2
    '          #define GLCD_CS portc.1
    '          #define GLCD_RESET portc.0
    
     

    Last edit: Anobium 2014-10-22

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.