Module – ST7920 – 128×64 LCD Display
Hardware
Uitvoeringen
V1.0
Bij deze versie van het display is de communicatie standaard op PARALLEL gezet, wil je seriële gegevensoverdracht gebruiken?, soldeer dan de weerstanden R9 en R11 eraf.
Informatie (ENG)
The reason is, VDD is actually connected to PSB through the 0Ω resistors (R9 and R11), making PSB always HIGH, putting the LCD always in parallel bus mode. Connecting GND to this could end badly to your LCD and Arduino as you are basically connecting 5V to GND directly. So, just de-solder it. Don’t worry, you can still connect it in parallel bus mode by connecting PSB to 5V.
V2.0
Bij deze versie van het display kan je door middel van de S(erial) en P(arallel) Jumperbrug JP2 seriële of parallelle communicatie instellen, maar dit hoeft niet, want je kan dit “selecteren” door Pin PSB laag te maken voor seriële overdracht.
Bronnen:
geekistuff.blogspot.com
Pinout
Arduino
Sluit de module aan volgens onderstaand overzicht (Seriële modus SPI):
Scripts
Script #1, met U8GLIB v1.x
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
#include "U8glib.h" U8GLIB_ST7920_128X64_4X u8g(10); const uint8_t rook_bitmap[] U8G_PROGMEM = { 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, 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, 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, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xff, 0xff, 0x03, 0x00, 0x78, 0x0e, 0xee, 0x3f, 0x7c, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfc, 0x02, 0x00, 0x78, 0x1e, 0xee, 0xff, 0x7c, 0xf8, 0xf0, 0xe1, 0x00, 0x00, 0x00, 0xfe, 0x07, 0xf0, 0x01, 0x00, 0x78, 0x3e, 0xee, 0xff, 0x7d, 0xf8, 0xf0, 0xe3, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf0, 0x01, 0x00, 0x78, 0x7e, 0xce, 0xf3, 0x7f, 0xf8, 0xf0, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf0, 0x01, 0x00, 0x78, 0xfe, 0xce, 0xe3, 0x7f, 0xfc, 0xf1, 0x67, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf3, 0x00, 0x00, 0x78, 0xfe, 0xcf, 0xe3, 0x7b, 0xfc, 0xf1, 0x6f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfb, 0x00, 0x00, 0x78, 0xfe, 0xcf, 0xc3, 0x7b, 0xee, 0xf3, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0x78, 0xf6, 0xcf, 0xe3, 0x7b, 0xfe, 0x73, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x78, 0xe6, 0xcf, 0xe3, 0x7f, 0xff, 0x77, 0x7e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x78, 0xc6, 0xcf, 0xe3, 0x7d, 0xff, 0x77, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x78, 0x86, 0xcf, 0xfb, 0xfd, 0xc7, 0x7f, 0x78, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x78, 0x0e, 0xef, 0xff, 0xfc, 0x83, 0x7f, 0x70, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x78, 0x0e, 0xee, 0x3f, 0xfc, 0x83, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0xf8, 0xe7, 0x1f, 0xfe, 0x79, 0xe0, 0x7c, 0xff, 0xfe, 0x01, 0x00, 0x00, 0xc0, 0xff, 0x03, 0x00, 0xf8, 0xef, 0x7f, 0xfe, 0x79, 0xf0, 0x7c, 0xff, 0xfe, 0x07, 0x00, 0x00, 0x80, 0xff, 0x07, 0x00, 0xf8, 0xef, 0x7f, 0xfe, 0x79, 0xf0, 0x7c, 0xff, 0xfe, 0x07, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0x78, 0xef, 0x7b, 0x1e, 0xf8, 0xf8, 0x7c, 0x0f, 0xbe, 0x07, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x78, 0xef, 0x7b, 0x1e, 0xfc, 0xf8, 0x7d, 0x0f, 0xbe, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x78, 0xcf, 0x7b, 0xfe, 0xfc, 0xfd, 0x7d, 0xff, 0xfe, 0x07, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xf8, 0xcf, 0x7f, 0xfe, 0xfc, 0xfd, 0x7d, 0xff, 0xfe, 0x07, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0xc3, 0x1f, 0xfe, 0xfc, 0xff, 0x7d, 0xff, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x78, 0xe0, 0x3f, 0x1e, 0xfc, 0xef, 0x7d, 0x0f, 0xfe, 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x78, 0xe0, 0x7f, 0x1e, 0xdc, 0xef, 0x7d, 0x0f, 0xfe, 0x07, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x03, 0x78, 0xe0, 0x7f, 0xfe, 0xdd, 0xe7, 0x7d, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x03, 0x78, 0xe0, 0xfb, 0xfe, 0x9d, 0xe7, 0x7d, 0xff, 0xbf, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x07, 0x78, 0xe0, 0xfb, 0xfe, 0x9f, 0xe3, 0x7f, 0xff, 0xbf, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x78, 0xf0, 0x0f, 0x1c, 0xe0, 0xcf, 0xc3, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x78, 0xf0, 0x0f, 0x1e, 0xf8, 0xcf, 0xc3, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x78, 0xf0, 0x0f, 0x3e, 0xfc, 0xce, 0xc3, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x1f, 0x78, 0xf0, 0x00, 0x3f, 0x3c, 0xcc, 0xc3, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0x78, 0xf0, 0x00, 0x7f, 0x3e, 0xc0, 0xc3, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x03, 0x78, 0xf0, 0x8f, 0x7f, 0x1e, 0xc0, 0xc3, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x78, 0xf0, 0x8f, 0x7b, 0x1e, 0xc0, 0xc3, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x78, 0xf0, 0x8f, 0xff, 0x1e, 0xdf, 0xc3, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x78, 0xf0, 0xc0, 0xff, 0x3e, 0xde, 0xc3, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x78, 0xf0, 0xc0, 0xff, 0x3f, 0xde, 0xc3, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0xf8, 0xfe, 0xfd, 0xf1, 0x7d, 0xde, 0xe7, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0xf8, 0xff, 0xff, 0xf0, 0xff, 0x9f, 0xff, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0xf8, 0xff, 0xff, 0xe0, 0xf3, 0x1f, 0x7f, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; void draw(void) { //u8g.setFont(u8g_font_unifont); u8g.setFont(u8g_font_osb18); u8g.drawStr( 07, 27, "CIRCUIT"); u8g.drawStr( 12, 52, "DIGEST"); } void picture(void) { u8g.drawXBMP( 0, 0, 128, 64, rook_bitmap); } void next(void) { u8g.setFont(u8g_font_unifont); //u8g.setFont(u8g_font_osb18); u8g.drawStr( 07, 18, "Interfacing"); u8g.drawStr( 07, 38, "Graphical LCD"); u8g.drawStr( 07, 58, "with Arduino"); } void clearLCD(){ u8g.firstPage(); do { } while( u8g.nextPage() ); } void setup(void) { // assign default color value if ( u8g.getMode() == U8G_MODE_R3G3B2 ) { u8g.setColorIndex(255); // white } else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) { u8g.setColorIndex(3); // max intensity } else if ( u8g.getMode() == U8G_MODE_BW ) { u8g.setColorIndex(1); // pixel on } else if ( u8g.getMode() == U8G_MODE_HICOLOR ) { u8g.setHiColorByRGB(255,255,255); } } void loop(void) { // picture loop u8g.firstPage(); do { u8g.drawFrame(1,2,126,62); draw(); } while( u8g.nextPage() ); delay(2000); clearLCD(); u8g.firstPage(); do { u8g.drawFrame(1,2,126,62); next(); } while( u8g.nextPage() ); delay(2000); clearLCD(); u8g.firstPage(); do { picture(); } while( u8g.nextPage() ); delay(3000); clearLCD(); // rebuild the picture after some delay delay(50); } |
Resultaat:
Script #2, met U8GLIB v2.x
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
/* GraphicsTest.ino Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) Copyright (c) 2016, olikraus@gmail.com All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <Arduino.h> #include <U8g2lib.h> #ifdef U8X8_HAVE_HW_SPI #include <SPI.h> #endif #ifdef U8X8_HAVE_HW_I2C #include <Wire.h> #endif U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8); void u8g2_prepare(void) { u8g2.setFont(u8g2_font_6x10_tf); u8g2.setFontRefHeightExtendedText(); u8g2.setDrawColor(1); u8g2.setFontPosTop(); u8g2.setFontDirection(0); } void u8g2_box_title(uint8_t a) { u8g2.drawStr( 10+a*2, 5, "U8g2"); u8g2.drawStr( 10, 20, "GraphicsTest"); u8g2.drawFrame(0,0,u8g2.getDisplayWidth(),u8g2.getDisplayHeight() ); } void u8g2_box_frame(uint8_t a) { u8g2.drawStr( 0, 0, "drawBox"); u8g2.drawBox(5,10,20,10); u8g2.drawBox(10+a,15,30,7); u8g2.drawStr( 0, 30, "drawFrame"); u8g2.drawFrame(5,10+30,20,10); u8g2.drawFrame(10+a,15+30,30,7); } void u8g2_disc_circle(uint8_t a) { u8g2.drawStr( 0, 0, "drawDisc"); u8g2.drawDisc(10,18,9); u8g2.drawDisc(24+a,16,7); u8g2.drawStr( 0, 30, "drawCircle"); u8g2.drawCircle(10,18+30,9); u8g2.drawCircle(24+a,16+30,7); } void u8g2_r_frame(uint8_t a) { u8g2.drawStr( 0, 0, "drawRFrame/Box"); u8g2.drawRFrame(5, 10,40,30, a+1); u8g2.drawRBox(50, 10,25,40, a+1); } void u8g2_string(uint8_t a) { u8g2.setFontDirection(0); u8g2.drawStr(30+a,31, " 0"); u8g2.setFontDirection(1); u8g2.drawStr(30,31+a, " 90"); u8g2.setFontDirection(2); u8g2.drawStr(30-a,31, " 180"); u8g2.setFontDirection(3); u8g2.drawStr(30,31-a, " 270"); } void u8g2_line(uint8_t a) { u8g2.drawStr( 0, 0, "drawLine"); u8g2.drawLine(7+a, 10, 40, 55); u8g2.drawLine(7+a*2, 10, 60, 55); u8g2.drawLine(7+a*3, 10, 80, 55); u8g2.drawLine(7+a*4, 10, 100, 55); } void u8g2_triangle(uint8_t a) { uint16_t offset = a; u8g2.drawStr( 0, 0, "drawTriangle"); u8g2.drawTriangle(14,7, 45,30, 10,40); u8g2.drawTriangle(14+offset,7-offset, 45+offset,30-offset, 57+offset,10-offset); u8g2.drawTriangle(57+offset*2,10, 45+offset*2,30, 86+offset*2,53); u8g2.drawTriangle(10+offset,40+offset, 45+offset,30+offset, 86+offset,53+offset); } void u8g2_ascii_1() { char s[2] = " "; uint8_t x, y; u8g2.drawStr( 0, 0, "ASCII page 1"); for( y = 0; y < 6; y++ ) { for( x = 0; x < 16; x++ ) { s[0] = y*16 + x + 32; u8g2.drawStr(x*7, y*10+10, s); } } } void u8g2_ascii_2() { char s[2] = " "; uint8_t x, y; u8g2.drawStr( 0, 0, "ASCII page 2"); for( y = 0; y < 6; y++ ) { for( x = 0; x < 16; x++ ) { s[0] = y*16 + x + 160; u8g2.drawStr(x*7, y*10+10, s); } } } void u8g2_extra_page(uint8_t a) { u8g2.drawStr( 0, 0, "Unicode"); u8g2.setFont(u8g2_font_unifont_t_symbols); u8g2.setFontPosTop(); u8g2.drawUTF8(0, 24, "☀ ☁"); switch(a) { case 0: case 1: case 2: case 3: u8g2.drawUTF8(a*3, 36, "☂"); break; case 4: case 5: case 6: case 7: u8g2.drawUTF8(a*3, 36, "☔"); break; } } void u8g2_xor(uint8_t a) { uint8_t i; u8g2.drawStr( 0, 0, "XOR"); u8g2.setFontMode(1); u8g2.setDrawColor(2); for( i = 0; i < 5; i++) { u8g2.drawBox(10+i*16, 18 + (i&1)*4, 21,31); } u8g2.drawStr( 5+a, 19, "XOR XOR XOR XOR"); u8g2.setDrawColor(0); u8g2.drawStr( 5+a, 29, "CLR CLR CLR CLR"); u8g2.setDrawColor(1); u8g2.drawStr( 5+a, 39, "SET SET SET SET"); u8g2.setFontMode(0); } #define cross_width 24 #define cross_height 24 static const unsigned char cross_bits[] U8X8_PROGMEM = { 0x00, 0x18, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x81, 0x00, 0x00, 0x81, 0x00, 0xC0, 0x00, 0x03, 0x38, 0x3C, 0x1C, 0x06, 0x42, 0x60, 0x01, 0x42, 0x80, 0x01, 0x42, 0x80, 0x06, 0x42, 0x60, 0x38, 0x3C, 0x1C, 0xC0, 0x00, 0x03, 0x00, 0x81, 0x00, 0x00, 0x81, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x18, 0x00, }; #define cross_fill_width 24 #define cross_fill_height 24 static const unsigned char cross_fill_bits[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x64, 0x00, 0x26, 0x84, 0x00, 0x21, 0x08, 0x81, 0x10, 0x08, 0x42, 0x10, 0x10, 0x3C, 0x08, 0x20, 0x00, 0x04, 0x40, 0x00, 0x02, 0x80, 0x00, 0x01, 0x80, 0x18, 0x01, 0x80, 0x18, 0x01, 0x80, 0x00, 0x01, 0x40, 0x00, 0x02, 0x20, 0x00, 0x04, 0x10, 0x3C, 0x08, 0x08, 0x42, 0x10, 0x08, 0x81, 0x10, 0x84, 0x00, 0x21, 0x64, 0x00, 0x26, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; #define cross_block_width 14 #define cross_block_height 14 static const unsigned char cross_block_bits[] U8X8_PROGMEM = { 0xFF, 0x3F, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0xC1, 0x20, 0xC1, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0xFF, 0x3F, }; void u8g2_bitmap_overlay(uint8_t a) { uint8_t frame_size = 28; u8g2.drawStr(0, 0, "Bitmap overlay"); u8g2.drawStr(0, frame_size + 12, "Solid / transparent"); u8g2.setBitmapMode(false /* solid */); u8g2.drawFrame(0, 10, frame_size, frame_size); u8g2.drawXBMP(2, 12, cross_width, cross_height, cross_bits); if(a & 4) u8g2.drawXBMP(7, 17, cross_block_width, cross_block_height, cross_block_bits); u8g2.setBitmapMode(true /* transparent*/); u8g2.drawFrame(frame_size + 5, 10, frame_size, frame_size); u8g2.drawXBMP(frame_size + 7, 12, cross_width, cross_height, cross_bits); if(a & 4) u8g2.drawXBMP(frame_size + 12, 17, cross_block_width, cross_block_height, cross_block_bits); } void u8g2_bitmap_modes(uint8_t transparent) { const uint8_t frame_size = 24; u8g2.drawBox(0, frame_size * 0.5, frame_size * 5, frame_size); u8g2.drawStr(frame_size * 0.5, 50, "Black"); u8g2.drawStr(frame_size * 2, 50, "White"); u8g2.drawStr(frame_size * 3.5, 50, "XOR"); if(!transparent) { u8g2.setBitmapMode(false /* solid */); u8g2.drawStr(0, 0, "Solid bitmap"); } else { u8g2.setBitmapMode(true /* transparent*/); u8g2.drawStr(0, 0, "Transparent bitmap"); } u8g2.setDrawColor(0);// Black u8g2.drawXBMP(frame_size * 0.5, 24, cross_width, cross_height, cross_bits); u8g2.setDrawColor(1); // White u8g2.drawXBMP(frame_size * 2, 24, cross_width, cross_height, cross_bits); u8g2.setDrawColor(2); // XOR u8g2.drawXBMP(frame_size * 3.5, 24, cross_width, cross_height, cross_bits); } uint8_t draw_state = 0; void draw(void) { u8g2_prepare(); switch(draw_state >> 3) { case 0: u8g2_box_title(draw_state&7); break; case 1: u8g2_box_frame(draw_state&7); break; case 2: u8g2_disc_circle(draw_state&7); break; case 3: u8g2_r_frame(draw_state&7); break; case 4: u8g2_string(draw_state&7); break; case 5: u8g2_line(draw_state&7); break; case 6: u8g2_triangle(draw_state&7); break; case 7: u8g2_ascii_1(); break; case 8: u8g2_ascii_2(); break; case 9: u8g2_extra_page(draw_state&7); break; case 10: u8g2_xor(draw_state&7); break; case 11: u8g2_bitmap_modes(0); break; case 12: u8g2_bitmap_modes(1); break; case 13: u8g2_bitmap_overlay(draw_state&7); break; } } void setup(void) { /* U8g2 Project: SSD1306 Test Board */ //pinMode(10, OUTPUT); //pinMode(9, OUTPUT); //digitalWrite(10, 0); //digitalWrite(9, 0); /* U8g2 Project: T6963 Test Board */ //pinMode(18, OUTPUT); //digitalWrite(18, 1); /* U8g2 Project: KS0108 Test Board */ //pinMode(16, OUTPUT); //digitalWrite(16, 0); u8g2.begin(); //u8g2.setFlipMode(0); } void loop(void) { // picture loop u8g2.firstPage(); do { draw(); } while( u8g2.nextPage() ); // increase the state draw_state++; if ( draw_state >= 14*8 ) draw_state = 0; // delay between each page delay(150); } |
Bron(nen):
circuitdigest.com
geekistuff.blogspot.com
forum.arduino.cc
Arduino Library
Installatie van Arduino IDE libraries: Arduino info
u8glib
A graphics library with support for many different monochrome displays.
- Gallery
- Latest version of U8glib for Arduino is available in the Library Manager
- Download Arduino Version from Github
- Bintray download links:
- U8glib for Arduino
- U8glib for AVR
- U8glib for ARM
- Converter for BDF fonts: bdf2u8g_101.exe on google drive.
- Supported environments:
- Arduino (ATMEGA and ARM)
- AVR (ATMEGA)
- ARM (with example for LPC1114)
- Library for graphic LCDs and OLEDs
- U8glib documentation and tutorials
- Graphical user interface library (GUI) available: M2tklib
- COM interfaces: Software SPI, Hardware SPI, 8Bit parallel
- Large number of fonts
- Monospaced and proportional fonts
- Mouse-Cursor support
- Landscape and portrait mode
- Many supported devices (SSD1325, ST7565, ST7920, UC1608, UC1610, UC1701, PCD8544, PCF8812, KS0108, LC7981, SBN1661, SSD1306, SH1106, T6963, LD7032)
- Well-defined interface to the device subsystem
https://github.com/olikraus/u8glib
- u8glib_avr_v1.18.1.7z 583,08 kb
- u8glib_arm_v1.18.1.7z 601,65 kb
- u8glib_Arduino-1.19.1.7z 594,14 kb
- u8glib_Arduino-1.18.1.7z 594,25 kb
- u8glib handleiding wiki.pdf.7z 6,15 MB
- u8glib (gedownload op 2016-01-07 @ github).7z 4,96 MB
u8glib2
U8g2: Library for monochrome displays, version 2
U8g2 is a monochrome graphics library for embedded devices. U8g2 supports monochrome OLEDs and LCDs, which include the following controllers: SSD1305, SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7567, ST7588, ST75256, NT7534, IST3020, ST7920, LD7032, KS0108, SED1520, SBN1661, IL3820, MAX7219 (see here for a full list).
The Arduino library U8g2 can be installed from the library manager of the Arduino IDE. U8g2 also includes U8x8 library:
- U8g2
- Includes all graphics procedures (line/box/circle draw).
- Supports many fonts. (Almost) no restriction on the font height.
- Requires some memory in the microcontroller to render the display.
- U8x8
- Text output only (character) device.
- Only fonts allowed with fit into a 8×8 pixel grid.
- Writes directly to the display. No buffer in the microcontroller required.
https://github.com/olikraus/u8g2
- u8glib-master (DL @ 2019-01-27).7z 5,25 MB
- u8g2-master (DL @ 2019-01-27).7z 27,36 MB
Afmetingen
Schema
GEEN GEGEVENS
Teardown
GEEN GEGEVENS
Datasheet
Fritzing
Downloads
GEEN GEGEVENS