CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / GizmoBlog / MMBasic Language / LCD Modules and Graphics / SPI-connected LCD Displays / NOKIA5110 LCD Driver

NOKIA5110 LCD Driver

The MMBasic on the CGMICROMITE2 (and thus the CGMICROKIT product) supports the ILI9341 based displays using a SPI interface. These are 2.2, 2.4 or 2.8 inch displays with a resolution of 240 by 320 pixels and a color depth of 262K/65K. The driver for the display is built in.

An alternate to this display is an NOKIA5110-based LCD. This graphic display also interfaces via SPI, but it is a small 1.6 inches with a resolution of 84 by 48 pixels.

When this driver is used all of the display orientated features of MMBasic such as drawing lines, circles, text, fonts, etc will operate on this display. As this is a monochrome display, a color of zero i.e. RGB(black) is used to turn a pixel off and any other color will turn it on.

The SPI based display controllers share the SPI interface with the MMBasic program. Sharing the SPI channel is essentially transparent to the BASIC program.

These are the connections required between the LCD display board and a CGMICROMITE2 chip or CGMICROBOARD:

NOKIA5110 Display Signal description CGMICROMITE2 CGMICROBOARD
LIGHT Power supply for the backlight 3.3V
CLK Display SPI Clock uC Pin 25 uC Pin 4
DIN Display Data In (MOSI) uC Pin 3 uC Pin 5
DC Display Data/Command Control Configurable uC Pin 21
RST Display Reset (when pulled low) Configurable uC Pin 22
CE Display Chip Select Configurable uC Pin 23
GND  Ground Ground Ground
VCC LCD supply 3.3V 3.3V

Where a connection is listed as “configurable” then you get to pick the specific micocontroller (uC) pin for the purpose.

Configuring the Driver

Before the driver is loaded you need to change the I/O pins allocated to A0, RESET and CS to reflect your circuit. This is done by editing the NOKIA5110 driver code.

The I/O pin allocations are set in the call to the subroutine NOKIA5110 in the first few lines of the driver. The syntax is:

NOKIA5110 myaddr%, A0-Pin, RESET-Pin, CE-Pin, Contrast, Orientation

Where:

myaddr% is the address of the CSub (do not change this entry).

DC-Pin is the I/O pin to use for the LCD display A0 signal.

RESET-Pin is the I/O pin to use for the LCD display RESET signal.

CE-Pin is the I/O pin to use for the LCD display CS signal.

Contrast &HB8 is a typical value, any value between &HB0 and may be &HBF useful.

Orientation is the orientation of the display (1 = landscape, 2 = portrait, 3 = reverse landscape, 4 = reverse portrait).

A typical configuration for the 28-pin CGMICROMITE2 would be:

NOKIA5110 myaddr%, 2, 23, 6, 1

Note that you do not need to run the OPTION LCDPANEL command to setup this display; these configuration details are taken care of by the edits described above. Also, because the call to the NOKIA5110 driver is contained in the subroutine MM.Startup MMBasic will automatically initialize the driver every time the CGMICROMITE2 is powered up or reset.

Loading the Driver

To add the driver to MMBasic you must load the code into the CGMICROMITE2 and cycle the power. You can then test the display by entering GUI TEST LCDPANEL at the command prompt. You should see a series of circles being rapidly drawn on top of each other.

If you are happy with the operation of the driver (ie, GUI TEST LCDPANEL works as expected) you can then run the command LIBRARY SAVE at the command prompt. This will transfer the driver (and any other routines in program memory) to a part of flash memory where they will be available to MMBasic but they will not show when the LIST command is used and will not be deleted when a program is loaded or NEW is used.

Restart the CGMICROMITE2 again and, for all intents and purposes, the driver is part of MMBasic. You can load, edit, run and delete programs as per normal and the driver will remain in memory. The only way that it can be removed is with the LIBRARY DELETE command or if the CGMICROMITE2 is reset to its original default configuration.

This driver was written by Peter Mather.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
sub mm.startup
    NOKIA5110(2,3,4,&HBb,1) 'DCpin, RSTpin, CSpin, Contrast, orientation
end sub
'
CSUB NOKIA5110
    000001FA
    'spi_write_command
    27BDFFE0 AFBF001C AFB10018 AFB00014 309100FF 3C109D00 8E030090 8E02001C 
    8064002C 0040F809 24050005 8E030090 8E02001C 8064002D 0040F809 24050005 
    3C02BF80 AC515820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425820 
    3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF001C 8FB10018 
    8FB00014 03E00008 27BD0020 
    'LCD_setxy
    27BDFFE8 AFBF0014 AFB00010 00A08021 3084007F 34840080 0411FFD6 00000000 
    36040040 308400FF 0411FFD2 00000000 8FBF0014 8FB00010 03E00008 27BD0018 
    'updatedisplay
    27BDFFC8 AFBF0034 AFBE0030 AFB7002C AFB60028 AFB50024 AFB40020 AFB3001C 
    AFB20018 AFB10014 AFB00010 3C029D00 8C42008C 8C540000 928201F8 1040003B 
    3C02BF80 A28001F8 8C565830 8C575800 8C5E5840 34038060 AC435800 24030002 
    AC435830 24030C00 AC435840 00009021 00009821 3C119D00 26950054 3C10BF80 
    00002021 02602821 0411FFCD 00000000 8E230090 8E22001C 8064002D 0040F809 
    24050005 8E230090 8E22001C 8064002C 0040F809 24050006 26440054 0244102A 
    1040000D 26730001 02921821 02B29021 90620000 AE025820 8E025810 30420080 
    1040FFFD 00000000 8E025820 24630001 5472FFF8 90620000 24020006 1662FFE0 
    00809021 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 3C02BF80 
    AC565830 AC575800 AC5E5840 8FBF0034 8FBE0030 8FB7002C 8FB60028 8FB50024 
    8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0038 
    'DrawRectangleMEM
    27BDFFD0 AFBF002C AFB50028 AFB40024 AFB30020 AFB2001C AFB10018 AFB00014 
    00808821 00A09821 00C09021 00E0A021 3C029D00 8C42008C 8C420000 904401F9 
    240300F5 10830009 8FB00040 3C159D00 8EA2003C 0040F809 240402F8 8EA3008C 
    AC620000 2403FFF5 A04301F9 3C039D00 8C630090 80630015 24040002 14640009 
    24040003 24030053 00742023 00731823 0220A021 02409821 00609021 10000012 
    00808821 14640008 24040004 24030053 00718823 00729023 2403002F 00739823 
    10000009 0074A023 14640007 2403002F 00712023 00721823 02809021 0060A021 
    02608821 00809821 0232182A 14600005 0274182A 02201821 02408821 00609021 
    0274182A 14600005 2A230000 02601821 02809821 0060A021 2A230000 0003880B 
    24030053 2A240054 0064880A 2A440000 0004900B 2A440054 0064900A 2A630000 
    0003980B 2403002F 2A640030 0064980A 2A840000 0004A00B 2A840030 0064A00A 
    0251182A 10600029 0293402A 1000002C 24030001 24640007 28650000 0065200A 
    000428C3 00053080 00052100 00862023 000430C0 00C42023 00913021 000327C3 
    00042742 00642821 30A50007 00A42823 00A72804 12000006 30A500FF 00463021 
    90C40000 00A42825 10000006 A0C50000 00463021 00052827 90C40000 00852824 
    A0C50000 24630001 0283202A 1080FFE2 24640007 26310001 0251182A 10600004 
    24030001 10000007 A04301F8 24070001 1100FFD8 02601821 1000FFF7 26310001 
    A04301F8 8FBF002C 8FB50028 8FB40024 8FB30020 8FB2001C 8FB10018 8FB00014 
    03E00008 27BD0030 
    'DrawBitmapMEM
    27BDFFB0 AFBF004C AFBE0048 AFB70044 AFB60040 AFB5003C AFB40038 AFB30034 
    AFB20030 AFB1002C AFB00028 AFA40050 00A0A821 00C08821 AFA7005C 8FB00060 
    8FB30068 3C029D00 8C42008C 8C420000 904401F9 240300F5 10830009 8FB2006C 
    3C149D00 8E82003C 0040F809 240402F8 8E83008C AC620000 2403FFF5 A04301F9 
    8FA3005C 18600093 0200F021 AFB5001C 00112023 AFA40020 70711802 2463FFFF 
    AFA30014 AFB10024 0000B821 AFA00018 24140001 3C079D00 24080002 240A0003 
    10000080 240E0004 8CE60090 80CC0015 15880007 00602021 8CE40098 8C840000 
    2484FFFF 00603021 10000013 008B2023 158A000A 00000000 8CE40094 8C840000 
    2484FFFF 00832023 8CE60098 8CC60000 24C6FFFF 10000008 00CB3023 158E0006 
    01203021 8CE60094 8CC60000 24C6FFFF 00C33023 01202021 2C8C0054 51800030 
    24A50001 04C0002D 28CC0030 5180002C 24A50001 24CC0007 28CD0000 00CD600A 
    000C68C3 000D6080 000D6900 01AC6023 000C68C0 01AC6023 01842021 000667C3 
    000C6742 00CC3021 30C60007 00CC3023 00D43004 30C600FF 00066027 92CD0000 
    01B56824 11A0000C 318C00FF 8FAD0064 11A00005 00442021 908C0000 00CC3025 
    1000000E A0860000 90860000 01866024 1000000A A08C0000 12600005 00442021 
    908C0000 00CC3025 10000004 A0860000 90860000 01866024 A08C0000 24A50001 
    14B0FFB1 24630001 25EF0001 2718FFFF 11F10010 033EC821 01F71821 24640007 
    28760000 0096180B 0003B0C3 0256B021 00181FC3 00031F42 0303A821 32B50007 
    02A3A823 02B4A804 03201821 1000FF9E 00002821 8FA30010 24630001 AFA30010 
    14700004 256B0001 10000008 8FA40018 AFA00010 1A20FFF7 01604821 8FB90050 
    8FB80014 1000FFE4 00007821 24840001 AFA40018 8FAD001C 01BE6821 AFAD001C 
    8FA30014 8FA40020 00641821 AFA30014 8FAD0024 8FA30018 8FA4005C 10640005 
    02EDB821 1E00FFEA 8FAB001C 1000FFEF 8FA40018 24030001 A04301F8 8FBF004C 
    8FBE0048 8FB70044 8FB60040 8FB5003C 8FB40038 8FB30034 8FB20030 8FB1002C 
    8FB00028 03E00008 27BD0050 
    'getFPC
    27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008 27BD0008 
    'pstring
    27BDFFE0 AFBF001C AFB00018 00808021 00002021 3C059D00 24A507C4 27A60010 
    0411FFEF 00000000 8FA40010 3C029D00 8C42002C 0040F809 02042021 8FBF001C 
    8FB00018 03E00008 27BD0020 
    'main
    27BDFFC0 AFBF003C AFB50038 AFB40034 AFB30030 AFB2002C AFB10028 AFB00024 
    00809021 00A08821 00C09821 00E0A021 00002021 3C059D00 24A50830 27A60018 
    0411FFD4 00000000 3C109D00 8E020090 8E230000 A043002E 8E020090 8E430000 
    A043002C 8E020090 8E630000 A043002D 8E020090 8FA30050 8C630000 A0430015 
    8E02003C 0040F809 240402F8 8E03008C AC620000 2403FFF5 A04301F9 8E030090 
    8E020010 8064002E 24050008 0040F809 00003021 8E030090 8E020010 8064002E 
    24050065 0040F809 00003021 8E030090 8E02001C 8064002E 0040F809 24050006 
    8E030090 8E020010 8064002C 24050008 0040F809 00003021 8E030090 8E020010 
    8064002C 24050065 0040F809 00003021 8E030090 8E02001C 8064002C 0040F809 
    24050006 8E030090 8E020010 8064002D 24050008 0040F809 00003021 8E030090 
    8E020010 8064002D 24050065 0040F809 00003021 8E030090 8E02001C 8064002D 
    0040F809 24050006 3C02BF81 8C44F220 7C84D800 3C030661 3463A053 1083000B 
    24020050 3C02BF81 8C43F220 7C63D800 3C020660 3442A053 00621026 24030050 
    2404000C 0082180B 00601021 3C039D00 8C630088 00431021 8C430000 24020064 
    54620007 00008821 3C02BF80 8C515830 8C525800 8C555840 10000003 3C029D00 
    00009021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 
    10A3000B 24040014 3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00832026 
    24030014 24050003 00A4180B 00602021 24050008 0040F809 00003021 3C029D00 
    8C420010 3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 10A3000B 24040014 
    3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00832026 24030014 24050003 
    00A4180B 00602021 24050065 0040F809 00003021 3C029D00 8C420010 3C03BF81 
    8C65F220 7CA5D800 3C030661 3463A053 10A3000B 24040029 3C03BF81 8C64F220 
    7C84D800 3C030660 3463A053 00832026 24030029 2405000E 00A4180B 00602021 
    24050002 0040F809 00003021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 
    3C030661 3463A053 10A3000B 24040029 3C03BF81 8C64F220 7C84D800 3C030660 
    3463A053 00832026 24030029 2405000E 00A4180B 00602021 24050065 0040F809 
    00003021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 
    10A3000B 2404000E 3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00832026 
    2403000E 24050019 00A4180B 00602021 24050008 0040F809 00003021 3C029D00 
    8C420010 3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 10A3000B 2404000E 
    3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00832026 2403000E 24050019 
    00A4180B 00602021 24050065 0040F809 00003021 3C02BF81 8C43FA84 24040001 
    7C831804 AC43FA84 3C02BF81 8C43FB04 24040003 7C831804 AC43FB04 3C02BF80 
    34038060 AC435800 24030002 AC435830 24030C00 AC435840 16200005 3C109D00 
    8C515830 8C525800 8C555840 3C109D00 8E030090 8E02001C 8064002E 0040F809 
    24050006 8E020004 0040F809 24042710 8E030090 8E02001C 8064002E 0040F809 
    24050005 8E020004 0040F809 24042710 8E030090 8E02001C 8064002E 0040F809 
    24050006 8E020004 0040F809 24042710 24040021 0411FCD8 00000000 24040006 
    0411FCD5 00000000 24040014 0411FCD2 00000000 24040020 0411FCCF 00000000 
    2404000C 0411FCCC 00000000 24040021 0411FCC9 00000000 92840000 0411FCC6 
    00000000 24040020 0411FCC3 00000000 8E020090 90420015 30420001 10400008 
    3C029D00 8C430094 24040054 AC640000 8C420098 24030030 10000007 AC430000 
    8C430098 24040054 AC640000 8C420094 24030030 AC430000 8FA50018 3C029D00 
    8C430048 3C049D00 24840228 00852021 AC640000 8FA50018 8C43004C 3C049D00 
    24840470 00852021 AC640000 8FA50018 8C430084 3C049D00 248400CC 00852021 
    AC640000 8C430048 8C440094 8C860000 8C420098 8C470000 AFA00010 8C620000 
    00002021 00002821 24C6FFFF 0040F809 24E7FFFF 3C02BF80 AC515830 AC525800 
    AC555840 3C049D00 24840E00 0411FE71 00000000 8FBF003C 8FB50038 8FB40034 
    8FB30030 8FB2002C 8FB10028 8FB00024 03E00008 27BD0040 
    '.rodata
    'startup
    494B4F4E 31313541 72642030 72657669 616F6C20 0D646564 0000000A 
End CSUB

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2021 · Generate Pro Theme on Genesis Framework · WordPress · Log in