├── .gitignore ├── 8-bit ├── LCDops.c ├── LCDops.h ├── example │ ├── CMakeLists.txt │ ├── LCDops.c │ ├── LCDops.h │ ├── generalOps.c │ ├── generalOps.h │ ├── main.c │ ├── pico_sdk_import.cmake │ ├── presetChars.c │ ├── presetChars.h │ ├── presetMessages.c │ └── presetMessages.h ├── generalOps.c ├── generalOps.h ├── presetChars │ ├── presetChars.c │ └── presetChars.h └── presetMessages │ ├── presetMessages.c │ └── presetMessages.h ├── CHANGELOG.md ├── FUNCTIONS.md ├── LICENSE ├── README.md ├── demos ├── 20x4 │ ├── customChars.uf2 │ └── src │ │ └── customChars │ │ └── main.c └── 40x2 │ ├── demoText.uf2 │ └── src │ └── demoText │ └── main.c └── imgs ├── 40x2.jpg ├── LCD.jpg ├── bell.jpg ├── customCharacter1.png ├── customCharacter2.png ├── picoLCD.png ├── preset1.jpg ├── preset2.jpg ├── preset3.jpg ├── preset4.jpg └── screen_low.gif /.gitignore: -------------------------------------------------------------------------------- 1 | 8-bit/example/build/ 2 | -------------------------------------------------------------------------------- /8-bit/LCDops.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "pico/binary_info.h" 7 | #include "generalOps.h" 8 | 9 | /* 10 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 11 | License can be found at picoLCD/LICENSE 12 | */ 13 | 14 | extern int LCDpins[14]; 15 | 16 | int LCDdisplay = 0; 17 | 18 | void E_INSTRUCTION(){ 19 | gpio_put(LCDpins[9], false); 20 | sleep_ms(5); 21 | gpio_put(LCDpins[8], true); 22 | sleep_ms(5); 23 | gpio_put(LCDpins[8], false); 24 | } 25 | void E_DATA(){ 26 | gpio_put(LCDpins[9], true); 27 | sleep_ms(5); 28 | gpio_put(LCDpins[8], true); 29 | sleep_ms(5); 30 | gpio_put(LCDpins[8], false); 31 | sleep_ms(5); 32 | gpio_put(LCDpins[9], false); 33 | } 34 | 35 | void detectLCD(){ 36 | switch (LCDpins[11]){ 37 | case 16: 38 | if (LCDpins[12] == 2){ 39 | LCDdisplay = 1; 40 | } else if (LCDpins[12] == 4){ 41 | LCDdisplay = 2; 42 | } 43 | break; 44 | case 20: 45 | if (LCDpins[12] == 2){ 46 | LCDdisplay = 3; 47 | } else if (LCDpins[12] == 4){ 48 | LCDdisplay = 4; 49 | } 50 | break; 51 | case 40: 52 | LCDdisplay = 5; 53 | break; 54 | default: 55 | LCDdisplay = 88; 56 | break; 57 | } 58 | } 59 | 60 | void LCDsendRawInstruction(int RS_PIN, int RW_PIN, char binary[]){ 61 | binIns(binary); 62 | if (RW_PIN == 0){ 63 | gpio_put(LCDpins[10], false); 64 | } else{ 65 | gpio_put(LCDpins[10], true); 66 | } 67 | if (RS_PIN == 0){ 68 | E_INSTRUCTION(); 69 | } else{ 70 | E_DATA(); 71 | } 72 | gpio_put(LCDpins[9], false); 73 | } 74 | 75 | void LCDinit(){ 76 | sleep_ms(8); 77 | //Increment mode for the cursor 0x06 - 0000 0110 78 | LCDsendRawInstruction(0,0,"00000110"); 79 | sleep_ms(8); 80 | //Display on, cursor on, blink on 0x0C - 0000 1111 81 | LCDsendRawInstruction(0,0,"00001111"); 82 | sleep_ms(8); 83 | //8-bit data bus, 2 line display 0x38 - 00111000 84 | if (LCDpins[12] == 1){ 85 | LCDsendRawInstruction(0,0,"00110000"); 86 | } else { 87 | LCDsendRawInstruction(0,0,"00111000"); 88 | } 89 | detectLCD(); 90 | } 91 | void LCDclear(){ 92 | sleep_ms(8); 93 | //Clear Dispaly 0x01 - 00000001 94 | LCDsendRawInstruction(0,0,"00000001"); 95 | sleep_ms(8); 96 | //Return Display if moved 0x02 - 00000010 97 | LCDsendRawInstruction(0,0,"00000010"); 98 | sleep_ms(8); 99 | //Move cursor to 0,0 0x80 - 10000000 100 | LCDsendRawInstruction(0,0,"10000000"); 101 | } 102 | 103 | void LCDgoto(char hexstring[]){ 104 | int hexDec = (int)strtol(hexstring, NULL, 16); 105 | decToBin(hexDec); 106 | gpio_put(LCDpins[7], true); 107 | E_INSTRUCTION(); 108 | sleep_ms(8); 109 | } 110 | 111 | /* 112 | 0 - Not run 113 | 1 - 1602 114 | 2 - 1604 115 | 3 - 2002 116 | 4 - 2004 117 | 5 - 4002 118 | */ 119 | 120 | void LCDwriteMessage(char message[]){ 121 | switch (LCDdisplay){ 122 | case 1: 123 | for (int i = 0; i < strlen(message); i++){ 124 | if (i == 16) { 125 | LCDgoto("40"); 126 | sleep_ms(3); 127 | } 128 | int tmp = (int)message[i]; 129 | decToBin(tmp); 130 | E_DATA(); 131 | } 132 | break; 133 | case 2: 134 | for (int i = 0; i < strlen(message); i++){ 135 | switch (i){ 136 | case 16: 137 | LCDgoto("40"); 138 | sleep_ms(3); 139 | break; 140 | case 32: 141 | LCDgoto("14"); 142 | sleep_ms(3); 143 | break; 144 | case 48: 145 | LCDgoto("54"); 146 | sleep_ms(3); 147 | break; 148 | } 149 | int tmp = (int)message[i]; 150 | decToBin(tmp); 151 | E_DATA(); 152 | } 153 | break; 154 | case 3: 155 | for (int i = 0; i < strlen(message); i++){ 156 | if (i == 20) { 157 | LCDgoto("40"); 158 | sleep_ms(3); 159 | } 160 | int tmp = (int)message[i]; 161 | decToBin(tmp); 162 | E_DATA(); 163 | } 164 | break; 165 | case 4: 166 | for (int i = 0; i < strlen(message); i++){ 167 | switch (i){ 168 | case 20: 169 | LCDgoto("40"); 170 | //sleep_ms(3); 171 | break; 172 | case 40: 173 | LCDgoto("14"); 174 | //sleep_ms(3); 175 | break; 176 | case 60: 177 | LCDgoto("54"); 178 | //sleep_ms(3); 179 | break; 180 | } 181 | int tmp = (int)message[i]; 182 | decToBin(tmp); 183 | E_DATA(); 184 | } 185 | break; 186 | case 5: 187 | for (int i = 0; i < strlen(message); i++){ 188 | int tmp = (int)message[i]; 189 | decToBin(tmp); 190 | E_DATA(); 191 | } 192 | break; 193 | default: 194 | for (int i = 0; i < strlen(message); i++){ 195 | if (i == 16) { 196 | LCDgoto("40"); 197 | sleep_ms(3); 198 | } 199 | int tmp = (int)message[i]; 200 | decToBin(tmp); 201 | E_DATA(); 202 | } 203 | break; 204 | } 205 | } 206 | 207 | void LCDwriteRawMessage(char message[]){ 208 | for (int i = 0; i < strlen(message); i++){ 209 | int tmp = (int)message[i]; 210 | decToBin(tmp); 211 | E_DATA(); 212 | } 213 | } 214 | 215 | void LCDwriteAscii(int code){ 216 | decToBin(code); 217 | E_DATA(); 218 | } 219 | 220 | void LCDdisplayControl(int display, int cursor, int blink){ 221 | char binary[] = ""; 222 | sprintf(binary, "00001%d%d%d", display, cursor, blink); 223 | LCDsendRawInstruction(0, 0, binary); 224 | } 225 | 226 | void LCDcreateCharacter(int charnum, char line1[], char line2[], char line3[], char line4[], char line5[], char line6[], char line7[], char line8[]){ 227 | switch (charnum) { 228 | case 1: 229 | LCDsendRawInstruction(0,0,"01000000"); 230 | LCDsendRawInstruction(1,0,line1); 231 | LCDsendRawInstruction(1,0,line2); 232 | LCDsendRawInstruction(1,0,line3); 233 | LCDsendRawInstruction(1,0,line4); 234 | LCDsendRawInstruction(1,0,line5); 235 | LCDsendRawInstruction(1,0,line6); 236 | LCDsendRawInstruction(1,0,line7); 237 | LCDsendRawInstruction(1,0,line8); 238 | sleep_ms(8); 239 | break; 240 | case 2: 241 | LCDsendRawInstruction(0,0,"01001000"); 242 | LCDsendRawInstruction(1,0,line1); 243 | LCDsendRawInstruction(1,0,line2); 244 | LCDsendRawInstruction(1,0,line3); 245 | LCDsendRawInstruction(1,0,line4); 246 | LCDsendRawInstruction(1,0,line5); 247 | LCDsendRawInstruction(1,0,line6); 248 | LCDsendRawInstruction(1,0,line7); 249 | LCDsendRawInstruction(1,0,line8); 250 | sleep_ms(8); 251 | break; 252 | case 3: 253 | LCDsendRawInstruction(0,0,"01010000"); 254 | LCDsendRawInstruction(1,0,line1); 255 | LCDsendRawInstruction(1,0,line2); 256 | LCDsendRawInstruction(1,0,line3); 257 | LCDsendRawInstruction(1,0,line4); 258 | LCDsendRawInstruction(1,0,line5); 259 | LCDsendRawInstruction(1,0,line6); 260 | LCDsendRawInstruction(1,0,line7); 261 | LCDsendRawInstruction(1,0,line8); 262 | sleep_ms(8); 263 | break; 264 | case 4: 265 | LCDsendRawInstruction(0,0,"01011000"); 266 | LCDsendRawInstruction(1,0,line1); 267 | LCDsendRawInstruction(1,0,line2); 268 | LCDsendRawInstruction(1,0,line3); 269 | LCDsendRawInstruction(1,0,line4); 270 | LCDsendRawInstruction(1,0,line5); 271 | LCDsendRawInstruction(1,0,line6); 272 | LCDsendRawInstruction(1,0,line7); 273 | LCDsendRawInstruction(1,0,line8); 274 | sleep_ms(8); 275 | break; 276 | case 5: 277 | LCDsendRawInstruction(0,0,"01100000"); 278 | LCDsendRawInstruction(1,0,line1); 279 | LCDsendRawInstruction(1,0,line2); 280 | LCDsendRawInstruction(1,0,line3); 281 | LCDsendRawInstruction(1,0,line4); 282 | LCDsendRawInstruction(1,0,line5); 283 | LCDsendRawInstruction(1,0,line6); 284 | LCDsendRawInstruction(1,0,line7); 285 | LCDsendRawInstruction(1,0,line8); 286 | sleep_ms(8); 287 | break; 288 | case 6: 289 | LCDsendRawInstruction(0,0,"01101000"); 290 | LCDsendRawInstruction(1,0,line1); 291 | LCDsendRawInstruction(1,0,line2); 292 | LCDsendRawInstruction(1,0,line3); 293 | LCDsendRawInstruction(1,0,line4); 294 | LCDsendRawInstruction(1,0,line5); 295 | LCDsendRawInstruction(1,0,line6); 296 | LCDsendRawInstruction(1,0,line7); 297 | LCDsendRawInstruction(1,0,line8); 298 | sleep_ms(8); 299 | break; 300 | case 7: 301 | LCDsendRawInstruction(0,0,"01110000"); 302 | LCDsendRawInstruction(1,0,line1); 303 | LCDsendRawInstruction(1,0,line2); 304 | LCDsendRawInstruction(1,0,line3); 305 | LCDsendRawInstruction(1,0,line4); 306 | LCDsendRawInstruction(1,0,line5); 307 | LCDsendRawInstruction(1,0,line6); 308 | LCDsendRawInstruction(1,0,line7); 309 | LCDsendRawInstruction(1,0,line8); 310 | sleep_ms(8); 311 | break; 312 | case 8: 313 | LCDsendRawInstruction(0,0,"01111000"); 314 | LCDsendRawInstruction(1,0,line1); 315 | LCDsendRawInstruction(1,0,line2); 316 | LCDsendRawInstruction(1,0,line3); 317 | LCDsendRawInstruction(1,0,line4); 318 | LCDsendRawInstruction(1,0,line5); 319 | LCDsendRawInstruction(1,0,line6); 320 | LCDsendRawInstruction(1,0,line7); 321 | LCDsendRawInstruction(1,0,line8); 322 | sleep_ms(8); 323 | break; 324 | } 325 | } 326 | 327 | void LCDwriteCustomCharacter(int characterNum){ 328 | sleep_ms(8); 329 | switch (characterNum){ 330 | case 1: 331 | LCDsendRawInstruction(1,0,"00000000"); 332 | break; 333 | case 2: 334 | LCDsendRawInstruction(1,0,"00000001"); 335 | break; 336 | case 3: 337 | LCDsendRawInstruction(1,0,"00000010"); 338 | break; 339 | case 4: 340 | LCDsendRawInstruction(1,0,"00000011"); 341 | break; 342 | case 5: 343 | LCDsendRawInstruction(1,0,"00000100"); 344 | break; 345 | case 6: 346 | LCDsendRawInstruction(1,0,"00000101"); 347 | break; 348 | case 7: 349 | LCDsendRawInstruction(1,0,"00000110"); 350 | break; 351 | case 8: 352 | LCDsendRawInstruction(1,0,"00000111"); 353 | break; 354 | } 355 | } 356 | 357 | void LCDshiftCursor(int rl){ 358 | if (rl == 0){ 359 | LCDsendRawInstruction(0,0,"00010000"); 360 | } else { 361 | LCDsendRawInstruction(0,0,"00010100"); 362 | } 363 | } 364 | 365 | void LCDshiftDisplay(int rl){ 366 | if (rl == 0){ 367 | LCDsendRawInstruction(0,0,"00011000"); 368 | } else { 369 | LCDsendRawInstruction(0,0,"00011100"); 370 | } 371 | } 372 | -------------------------------------------------------------------------------- /8-bit/LCDops.h: -------------------------------------------------------------------------------- 1 | void LCDinit(); 2 | void LCDclear(); 3 | void E_INSTRUCTION(); 4 | void E_DATA(); 5 | void LCDgoto(char hexstring[]); 6 | void LCDwriteMessage(char message[]); 7 | void LCDwriteRawMessage(char message[]); 8 | void LCDsendRawInstruction(int RS_PIN, int RW_PIN, char binary[]); 9 | void LCDwriteAscii(int code); 10 | void LCDdisplayControl(int display, int cursor, int blink); 11 | void LCDcreateCharacter(int charnum, char line1[], char line2[], char line3[], char line4[], char line5[], char line6[], char line7[], char line8[]); 12 | void LCDwriteCustomCharacter(int characterNum); 13 | void LCDshiftCursor(int rl); 14 | void LCDshiftDisplay(int rl); 15 | void detectLCD(); 16 | -------------------------------------------------------------------------------- /8-bit/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(picoLCD) 6 | 7 | pico_sdk_init() 8 | 9 | add_executable(picoLCD 10 | main.c 11 | LCDops.c 12 | generalOps.c 13 | presetChars.c 14 | presetMessages.c 15 | ) 16 | 17 | pico_enable_stdio_usb(picoLCD 1) 18 | pico_enable_stdio_uart(picoLCD 1) 19 | 20 | pico_add_extra_outputs(picoLCD) 21 | 22 | target_link_libraries(picoLCD pico_stdlib) 23 | -------------------------------------------------------------------------------- /8-bit/example/LCDops.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "pico/binary_info.h" 7 | #include "generalOps.h" 8 | 9 | /* 10 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 11 | License can be found at picoLCD/LICENSE 12 | */ 13 | 14 | extern int LCDpins[14]; 15 | 16 | int LCDdisplay = 0; 17 | 18 | void E_INSTRUCTION(){ 19 | gpio_put(LCDpins[9], false); 20 | sleep_ms(5); 21 | gpio_put(LCDpins[8], true); 22 | sleep_ms(5); 23 | gpio_put(LCDpins[8], false); 24 | } 25 | void E_DATA(){ 26 | gpio_put(LCDpins[9], true); 27 | sleep_ms(5); 28 | gpio_put(LCDpins[8], true); 29 | sleep_ms(5); 30 | gpio_put(LCDpins[8], false); 31 | sleep_ms(5); 32 | gpio_put(LCDpins[9], false); 33 | } 34 | 35 | void detectLCD(){ 36 | switch (LCDpins[11]){ 37 | case 16: 38 | if (LCDpins[12] == 2){ 39 | LCDdisplay = 1; 40 | } else if (LCDpins[12] == 4){ 41 | LCDdisplay = 2; 42 | } 43 | break; 44 | case 20: 45 | if (LCDpins[12] == 2){ 46 | LCDdisplay = 3; 47 | } else if (LCDpins[12] == 4){ 48 | LCDdisplay = 4; 49 | } 50 | break; 51 | case 40: 52 | LCDdisplay = 5; 53 | break; 54 | default: 55 | LCDdisplay = 88; 56 | break; 57 | } 58 | } 59 | 60 | void LCDsendRawInstruction(int RS_PIN, int RW_PIN, char binary[]){ 61 | binIns(binary); 62 | if (RW_PIN == 0){ 63 | gpio_put(LCDpins[10], false); 64 | } else{ 65 | gpio_put(LCDpins[10], true); 66 | } 67 | if (RS_PIN == 0){ 68 | E_INSTRUCTION(); 69 | } else{ 70 | E_DATA(); 71 | } 72 | gpio_put(LCDpins[9], false); 73 | } 74 | 75 | void LCDinit(){ 76 | sleep_ms(8); 77 | //Increment mode for the cursor 0x06 - 0000 0110 78 | LCDsendRawInstruction(0,0,"00000110"); 79 | sleep_ms(8); 80 | //Display on, cursor on, blink on 0x0C - 0000 1111 81 | LCDsendRawInstruction(0,0,"00001111"); 82 | sleep_ms(8); 83 | //8-bit data bus, 2 line display 0x38 - 00111000 84 | if (LCDpins[12] == 1){ 85 | LCDsendRawInstruction(0,0,"00110000"); 86 | } else { 87 | LCDsendRawInstruction(0,0,"00111000"); 88 | } 89 | detectLCD(); 90 | } 91 | void LCDclear(){ 92 | sleep_ms(8); 93 | //Clear Dispaly 0x01 - 00000001 94 | LCDsendRawInstruction(0,0,"00000001"); 95 | sleep_ms(8); 96 | //Return Display if moved 0x02 - 00000010 97 | LCDsendRawInstruction(0,0,"00000010"); 98 | sleep_ms(8); 99 | //Move cursor to 0,0 0x80 - 10000000 100 | LCDsendRawInstruction(0,0,"10000000"); 101 | } 102 | 103 | void LCDgoto(char hexstring[]){ 104 | int hexDec = (int)strtol(hexstring, NULL, 16); 105 | decToBin(hexDec); 106 | gpio_put(LCDpins[7], true); 107 | E_INSTRUCTION(); 108 | sleep_ms(8); 109 | } 110 | 111 | /* 112 | 0 - Not run 113 | 1 - 1602 114 | 2 - 1604 115 | 3 - 2002 116 | 4 - 2004 117 | 5 - 4002 118 | */ 119 | 120 | void LCDwriteMessage(char message[]){ 121 | switch (LCDdisplay){ 122 | case 1: 123 | for (int i = 0; i < strlen(message); i++){ 124 | if (i == 16) { 125 | LCDgoto("40"); 126 | sleep_ms(3); 127 | } 128 | int tmp = (int)message[i]; 129 | decToBin(tmp); 130 | E_DATA(); 131 | } 132 | break; 133 | case 2: 134 | for (int i = 0; i < strlen(message); i++){ 135 | switch (i){ 136 | case 16: 137 | LCDgoto("40"); 138 | sleep_ms(3); 139 | break; 140 | case 32: 141 | LCDgoto("14"); 142 | sleep_ms(3); 143 | break; 144 | case 48: 145 | LCDgoto("54"); 146 | sleep_ms(3); 147 | break; 148 | } 149 | int tmp = (int)message[i]; 150 | decToBin(tmp); 151 | E_DATA(); 152 | } 153 | break; 154 | case 3: 155 | for (int i = 0; i < strlen(message); i++){ 156 | if (i == 20) { 157 | LCDgoto("40"); 158 | sleep_ms(3); 159 | } 160 | int tmp = (int)message[i]; 161 | decToBin(tmp); 162 | E_DATA(); 163 | } 164 | break; 165 | case 4: 166 | for (int i = 0; i < strlen(message); i++){ 167 | switch (i){ 168 | case 20: 169 | LCDgoto("40"); 170 | //sleep_ms(3); 171 | break; 172 | case 40: 173 | LCDgoto("14"); 174 | //sleep_ms(3); 175 | break; 176 | case 60: 177 | LCDgoto("54"); 178 | //sleep_ms(3); 179 | break; 180 | } 181 | int tmp = (int)message[i]; 182 | decToBin(tmp); 183 | E_DATA(); 184 | } 185 | break; 186 | case 5: 187 | for (int i = 0; i < strlen(message); i++){ 188 | int tmp = (int)message[i]; 189 | decToBin(tmp); 190 | E_DATA(); 191 | } 192 | break; 193 | default: 194 | for (int i = 0; i < strlen(message); i++){ 195 | if (i == 16) { 196 | LCDgoto("40"); 197 | sleep_ms(3); 198 | } 199 | int tmp = (int)message[i]; 200 | decToBin(tmp); 201 | E_DATA(); 202 | } 203 | break; 204 | } 205 | } 206 | 207 | void LCDwriteRawMessage(char message[]){ 208 | for (int i = 0; i < strlen(message); i++){ 209 | int tmp = (int)message[i]; 210 | decToBin(tmp); 211 | E_DATA(); 212 | } 213 | } 214 | 215 | void LCDwriteAscii(int code){ 216 | decToBin(code); 217 | E_DATA(); 218 | } 219 | 220 | void LCDdisplayControl(int display, int cursor, int blink){ 221 | char binary[] = ""; 222 | sprintf(binary, "00001%d%d%d", display, cursor, blink); 223 | LCDsendRawInstruction(0, 0, binary); 224 | } 225 | 226 | void LCDcreateCharacter(int charnum, char line1[], char line2[], char line3[], char line4[], char line5[], char line6[], char line7[], char line8[]){ 227 | switch (charnum) { 228 | case 1: 229 | LCDsendRawInstruction(0,0,"01000000"); 230 | LCDsendRawInstruction(1,0,line1); 231 | LCDsendRawInstruction(1,0,line2); 232 | LCDsendRawInstruction(1,0,line3); 233 | LCDsendRawInstruction(1,0,line4); 234 | LCDsendRawInstruction(1,0,line5); 235 | LCDsendRawInstruction(1,0,line6); 236 | LCDsendRawInstruction(1,0,line7); 237 | LCDsendRawInstruction(1,0,line8); 238 | sleep_ms(8); 239 | break; 240 | case 2: 241 | LCDsendRawInstruction(0,0,"01001000"); 242 | LCDsendRawInstruction(1,0,line1); 243 | LCDsendRawInstruction(1,0,line2); 244 | LCDsendRawInstruction(1,0,line3); 245 | LCDsendRawInstruction(1,0,line4); 246 | LCDsendRawInstruction(1,0,line5); 247 | LCDsendRawInstruction(1,0,line6); 248 | LCDsendRawInstruction(1,0,line7); 249 | LCDsendRawInstruction(1,0,line8); 250 | sleep_ms(8); 251 | break; 252 | case 3: 253 | LCDsendRawInstruction(0,0,"01010000"); 254 | LCDsendRawInstruction(1,0,line1); 255 | LCDsendRawInstruction(1,0,line2); 256 | LCDsendRawInstruction(1,0,line3); 257 | LCDsendRawInstruction(1,0,line4); 258 | LCDsendRawInstruction(1,0,line5); 259 | LCDsendRawInstruction(1,0,line6); 260 | LCDsendRawInstruction(1,0,line7); 261 | LCDsendRawInstruction(1,0,line8); 262 | sleep_ms(8); 263 | break; 264 | case 4: 265 | LCDsendRawInstruction(0,0,"01011000"); 266 | LCDsendRawInstruction(1,0,line1); 267 | LCDsendRawInstruction(1,0,line2); 268 | LCDsendRawInstruction(1,0,line3); 269 | LCDsendRawInstruction(1,0,line4); 270 | LCDsendRawInstruction(1,0,line5); 271 | LCDsendRawInstruction(1,0,line6); 272 | LCDsendRawInstruction(1,0,line7); 273 | LCDsendRawInstruction(1,0,line8); 274 | sleep_ms(8); 275 | break; 276 | case 5: 277 | LCDsendRawInstruction(0,0,"01100000"); 278 | LCDsendRawInstruction(1,0,line1); 279 | LCDsendRawInstruction(1,0,line2); 280 | LCDsendRawInstruction(1,0,line3); 281 | LCDsendRawInstruction(1,0,line4); 282 | LCDsendRawInstruction(1,0,line5); 283 | LCDsendRawInstruction(1,0,line6); 284 | LCDsendRawInstruction(1,0,line7); 285 | LCDsendRawInstruction(1,0,line8); 286 | sleep_ms(8); 287 | break; 288 | case 6: 289 | LCDsendRawInstruction(0,0,"01101000"); 290 | LCDsendRawInstruction(1,0,line1); 291 | LCDsendRawInstruction(1,0,line2); 292 | LCDsendRawInstruction(1,0,line3); 293 | LCDsendRawInstruction(1,0,line4); 294 | LCDsendRawInstruction(1,0,line5); 295 | LCDsendRawInstruction(1,0,line6); 296 | LCDsendRawInstruction(1,0,line7); 297 | LCDsendRawInstruction(1,0,line8); 298 | sleep_ms(8); 299 | break; 300 | case 7: 301 | LCDsendRawInstruction(0,0,"01110000"); 302 | LCDsendRawInstruction(1,0,line1); 303 | LCDsendRawInstruction(1,0,line2); 304 | LCDsendRawInstruction(1,0,line3); 305 | LCDsendRawInstruction(1,0,line4); 306 | LCDsendRawInstruction(1,0,line5); 307 | LCDsendRawInstruction(1,0,line6); 308 | LCDsendRawInstruction(1,0,line7); 309 | LCDsendRawInstruction(1,0,line8); 310 | sleep_ms(8); 311 | break; 312 | case 8: 313 | LCDsendRawInstruction(0,0,"01111000"); 314 | LCDsendRawInstruction(1,0,line1); 315 | LCDsendRawInstruction(1,0,line2); 316 | LCDsendRawInstruction(1,0,line3); 317 | LCDsendRawInstruction(1,0,line4); 318 | LCDsendRawInstruction(1,0,line5); 319 | LCDsendRawInstruction(1,0,line6); 320 | LCDsendRawInstruction(1,0,line7); 321 | LCDsendRawInstruction(1,0,line8); 322 | sleep_ms(8); 323 | break; 324 | } 325 | } 326 | 327 | void LCDwriteCustomCharacter(int characterNum){ 328 | sleep_ms(8); 329 | switch (characterNum){ 330 | case 1: 331 | LCDsendRawInstruction(1,0,"00000000"); 332 | break; 333 | case 2: 334 | LCDsendRawInstruction(1,0,"00000001"); 335 | break; 336 | case 3: 337 | LCDsendRawInstruction(1,0,"00000010"); 338 | break; 339 | case 4: 340 | LCDsendRawInstruction(1,0,"00000011"); 341 | break; 342 | case 5: 343 | LCDsendRawInstruction(1,0,"00000100"); 344 | break; 345 | case 6: 346 | LCDsendRawInstruction(1,0,"00000101"); 347 | break; 348 | case 7: 349 | LCDsendRawInstruction(1,0,"00000110"); 350 | break; 351 | case 8: 352 | LCDsendRawInstruction(1,0,"00000111"); 353 | break; 354 | } 355 | } 356 | 357 | void LCDshiftCursor(int rl){ 358 | if (rl == 0){ 359 | LCDsendRawInstruction(0,0,"00010000"); 360 | } else { 361 | LCDsendRawInstruction(0,0,"00010100"); 362 | } 363 | } 364 | 365 | void LCDshiftDisplay(int rl){ 366 | if (rl == 0){ 367 | LCDsendRawInstruction(0,0,"00011000"); 368 | } else { 369 | LCDsendRawInstruction(0,0,"00011100"); 370 | } 371 | } 372 | -------------------------------------------------------------------------------- /8-bit/example/LCDops.h: -------------------------------------------------------------------------------- 1 | void LCDinit(); 2 | void LCDclear(); 3 | void E_INSTRUCTION(); 4 | void E_DATA(); 5 | void LCDgoto(char hexstring[]); 6 | void LCDwriteMessage(char message[]); 7 | void LCDwriteRawMessage(char message[]); 8 | void LCDsendRawInstruction(int RS_PIN, int RW_PIN, char binary[]); 9 | void LCDwriteAscii(int code); 10 | void LCDdisplayControl(int display, int cursor, int blink); 11 | void LCDcreateCharacter(int charnum, char line1[], char line2[], char line3[], char line4[], char line5[], char line6[], char line7[], char line8[]); 12 | void LCDwriteCustomCharacter(int characterNum); 13 | void LCDshiftCursor(int rl); 14 | void LCDshiftDisplay(int rl); 15 | void detectLCD(); 16 | -------------------------------------------------------------------------------- /8-bit/example/generalOps.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "LCDops.h" 7 | 8 | /* 9 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 10 | License can be found at picoLCD/LICENSE 11 | */ 12 | 13 | extern int LCDpins[14]; 14 | 15 | void decToBin(int n){ 16 | int count = 0; 17 | char binaryTmp[9]; 18 | char binaryFinal[9] = ""; 19 | char extras = '0'; 20 | itoa(n,binaryTmp,2); 21 | count = strlen(binaryTmp); 22 | while (count < 8){ 23 | strncat(binaryFinal, &extras, 1); 24 | count++; 25 | } 26 | strcat(binaryFinal, binaryTmp); 27 | count = 0; 28 | for (int f = strlen(binaryFinal) - 1; f >= 0; f--){ 29 | if (binaryFinal[f] == '0'){ 30 | gpio_put(LCDpins[count], false); 31 | } else if (binaryFinal[f] == '1'){ 32 | gpio_put(LCDpins[count], true); 33 | } 34 | count ++; 35 | } 36 | } 37 | 38 | void binIns(char binaryFinal[]){ 39 | int count = 0; 40 | for (int f = strlen(binaryFinal) - 1; f >= 0; f--){ 41 | if (binaryFinal[f] == '0'){ 42 | gpio_put(LCDpins[count], false); 43 | } else if (binaryFinal[f] == '1'){ 44 | gpio_put(LCDpins[count], true); 45 | } 46 | count ++; 47 | } 48 | sleep_ms(3); 49 | } 50 | -------------------------------------------------------------------------------- /8-bit/example/generalOps.h: -------------------------------------------------------------------------------- 1 | void decToBin(int n); 2 | void binIns(char binaryFinal[]); 3 | -------------------------------------------------------------------------------- /8-bit/example/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pico/stdlib.h" 3 | #include "hardware/gpio.h" 4 | #include "pico/binary_info.h" 5 | #include "LCDops.h" 6 | #include "generalOps.h" 7 | #include "presetChars.h" 8 | #include "presetMessages.h" 9 | /* 10 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 11 | License can be found at picoLCD/LICENSE 12 | */ 13 | 14 | int LCDpins[14] = {0,1,2,3,4,5,6,7,15,16,17,16,2}; 15 | 16 | int main(){ 17 | bi_decl(bi_program_description("This is a work-in-progress example of interfacing with LCD Displays using HD44780 chips on the Raspberry Pi Pico!")); 18 | 19 | stdio_init_all(); 20 | 21 | //Initialize all needed pins as defined in LCDpins, set them as 22 | // outputs and then pull them low 23 | for(int gpio = 0; gpio < 11; gpio++){ 24 | gpio_init(LCDpins[gpio]); 25 | gpio_set_dir(LCDpins[gpio], true); 26 | gpio_put(LCDpins[gpio], false); 27 | } 28 | 29 | //Initialize and clear the LCD, prepping it for characters / instructions 30 | LCDinit(); 31 | LCDclear(); 32 | sleep_ms(8); 33 | LCDgoto("00"); 34 | LCDsendRawInstruction(0,0,"00001100"); 35 | LCDwriteMessage("Hello World!"); 36 | } 37 | -------------------------------------------------------------------------------- /8-bit/example/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /8-bit/example/presetChars.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pico/stdlib.h" 3 | #include "hardware/gpio.h" 4 | #include "pico/binary_info.h" 5 | #include "LCDops.h" 6 | 7 | /* 8 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 9 | License can be found at picoLCD/LICENSE 10 | */ 11 | 12 | void LCDactivatePreChar(int characterNum, int preset){ 13 | switch (preset){ 14 | case 1: //Music note 15 | LCDcreateCharacter(characterNum, "00000001", "00000011", "00000111", "00001101", "00001001", "00001011", "00011011", "00011000"); 16 | break; 17 | case 2: //tick 18 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00000001", "00000011", "00010110", "00011100", "00001000", "00000000"); 19 | break; 20 | case 3: //alarm bell 21 | LCDcreateCharacter(characterNum, "00000100", "00001110", "00001110", "00001110", "00001110", "00011111", "00000100", "00000000"); 22 | break; 23 | case 4: //up arrow 24 | LCDcreateCharacter(characterNum, "00000100", "00001110", "00010101", "00000100", "00000100", "00000100", "00000100", "00000000"); 25 | break; 26 | case 5: //down arroe 27 | LCDcreateCharacter(characterNum, "00000100", "00000100", "00000100", "00000100", "00010101", "00001110", "00000100", "00000000"); 28 | break; 29 | case 6: //Lock Locked 30 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00010001", "00011111", "00011011", "00011111", "00000000"); 31 | break; 32 | case 7: //Lock Unlocked 33 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00000001", "00011111", "00011011", "00011111", "00000000"); 34 | break; 35 | case 8: //Play 36 | LCDcreateCharacter(characterNum, "00000000", "00001000", "00001100", "00001110", "00001110", "00001100", "00001000", "0000000"); 37 | break; 38 | case 9: //Pause 39 | LCDcreateCharacter(characterNum, "00000000", "00011011", "00011011", "00011011", "00011011", "00011011", "00011011", "00000000"); 40 | break; 41 | case 10: //Next Track 42 | LCDcreateCharacter(characterNum, "00000000", "00001001", "00001101", "00001111", "00001111", "00001101", "00001001", "0000000"); 43 | break; 44 | case 11: //Previous Track 45 | LCDcreateCharacter(characterNum, "00000000", "00010010", "00010110", "00011110", "00011110", "00010110", "00010010", "00000000"); 46 | break; 47 | case 12: //Repeat Track 48 | LCDcreateCharacter(characterNum, "00000010", "00011111", "00010010", "00000000", "00001001", "00011111", "00001000", "00000000"); 49 | break; 50 | case 13: //Shuffle Track 51 | LCDcreateCharacter(characterNum, "00001110", "00010000", "00001110", "00000001", "00001110", "00000000", "00001010", "00010101"); 52 | break; 53 | case 14: //Muted 54 | LCDcreateCharacter(characterNum, "00010001", "00011011", "00010101", "00010001", "00010001", "00000000", "00010101", "00001010"); 55 | break; 56 | case 15: //Smiley Face 57 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00001010", "00000000", "00010001", "00001110", "00000000", "00000000"); 58 | break; 59 | case 16: //Frowny Face 60 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00001010", "00000000", "00001110", "00010001", "00000000", "00000000"); 61 | break; 62 | case 17: //Person 63 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00001110", "00000100", "00011111", "00001110", "00001110", "00000000"); 64 | break; 65 | case 18: //Heart 66 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00011111", "00011111", "00001110", "00000100", "00000000", "00000000"); 67 | break; 68 | case 19: //Battery_empty 69 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00010001", "00010001", "00011111", "00000000"); 70 | break; 71 | case 20: //Battery_1 72 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00010001", "00011111", "00011111", "00000000"); 73 | break; 74 | case 21: //Battery_2 75 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00011111", "00011111", "00011111", "00000000"); 76 | break; 77 | case 22: //Battery_3 78 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00011111", "00011111", "00011111", "00011111", "00000000"); 79 | break; 80 | case 23: //Battery_full 81 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00011111", "00011111", "00011111", "00011111", "00011111", "00000000"); 82 | break; 83 | case 24: //Battery_charging 84 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010101", "00010101", "00010001", "00011111", "00000000"); 85 | break; 86 | case 25: //Ohm 87 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00010001", "00010001", "00001010", "00011011", "00000000"); 88 | break; 89 | case 26: //Square Root 90 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00000011", "00000100", "00000100", "00010100", "00001000", "00000000"); 91 | break; 92 | case 27: //Pi 93 | LCDcreateCharacter(characterNum, "00000000", "00011111", "00001010", "00001010", "00001010", "00010011", "00000000", "00000000"); 94 | break; 95 | case 28: //:D 96 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00000000", "00011111", "00010001", "00001110", "00000000", "00000000"); 97 | break; 98 | case 29: //>:( 99 | LCDcreateCharacter(characterNum, "00010001", "00001010", "00010001", "00000100", "00000000", "00001110", "00010001", "00000000"); 100 | break; 101 | case 30: //:O 102 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00000000", "00001110", "00010001", "00010001", "00001110", "00000000"); 103 | break; 104 | } 105 | } 106 | /* 107 | : // 108 | LCDcreateCharacter(characterNum, "", "", "", "", "", "", "", ""); 109 | break; 110 | case 111 | */ 112 | -------------------------------------------------------------------------------- /8-bit/example/presetChars.h: -------------------------------------------------------------------------------- 1 | void LCDactivatePreChar(int characterNum, int preset); 2 | -------------------------------------------------------------------------------- /8-bit/example/presetMessages.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "pico/binary_info.h" 7 | #include "LCDops.h" 8 | #include "generalOps.h" 9 | 10 | /* 11 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 12 | License can be found at picoLCD/LICENSE 13 | */ 14 | 15 | extern int LCDpins[14]; 16 | 17 | extern int LCDdisplay; 18 | /* 19 | 0 - Not run 20 | 1 - 1602 21 | 2 - 1604 22 | 3 - 2002 23 | 4 - 2004 24 | 5 - 4002 25 | */ 26 | 27 | int lastRan = 0; 28 | 29 | void LCDactivateImpMess(){ 30 | if (LCDdisplay == 0){ 31 | detectLCD(); 32 | } 33 | LCDclear(); 34 | switch (LCDdisplay){ 35 | case 1: 36 | LCDdisplayControl(0, 0, 0); 37 | LCDwriteMessage("+---IMPORTANT--++---MESSAGE!---+"); 38 | sleep_ms(500); 39 | LCDdisplayControl(1, 0, 0); 40 | sleep_ms(500); 41 | LCDdisplayControl(0, 0, 0); 42 | sleep_ms(500); 43 | LCDdisplayControl(1, 0, 0); 44 | sleep_ms(500); 45 | LCDdisplayControl(0, 0, 0); 46 | LCDclear(); 47 | LCDwriteRawMessage("+---MESSAGE:---+"); 48 | sleep_ms(100); 49 | LCDdisplayControl(1, 0, 0); 50 | break; 51 | case 2: 52 | LCDdisplayControl(0, 0, 0); 53 | LCDwriteMessage("+--------------+| IMPORTANT || MESSAGE |+--------------+"); 54 | sleep_ms(500); 55 | LCDdisplayControl(1, 0, 0); 56 | sleep_ms(500); 57 | LCDdisplayControl(0, 0, 0); 58 | sleep_ms(500); 59 | LCDdisplayControl(1, 0, 0); 60 | sleep_ms(500); 61 | LCDdisplayControl(0, 0, 0); 62 | LCDclear(); 63 | LCDwriteRawMessage("+---IMPORTANT--+"); 64 | LCDgoto("54"); 65 | LCDwriteRawMessage("+----MESSAGE---+"); 66 | sleep_ms(100); 67 | LCDdisplayControl(1, 0, 0); 68 | break; 69 | case 3: 70 | LCDdisplayControl(0, 0, 0); 71 | LCDwriteMessage("+-----IMPORTANT----++-----MESSAGE!-----+"); 72 | sleep_ms(500); 73 | LCDdisplayControl(1, 0, 0); 74 | sleep_ms(500); 75 | LCDdisplayControl(0, 0, 0); 76 | sleep_ms(500); 77 | LCDdisplayControl(1, 0, 0); 78 | sleep_ms(500); 79 | LCDdisplayControl(0, 0, 0); 80 | LCDclear(); 81 | LCDwriteRawMessage("+-----MESSAGE:-----+"); 82 | sleep_ms(100); 83 | LCDdisplayControl(1, 0, 0); 84 | break; 85 | case 4: 86 | LCDdisplayControl(0, 0, 0); 87 | LCDwriteMessage("+------------------+| IMPORTANT || MESSAGE |+------------------+"); 88 | sleep_ms(500); 89 | LCDdisplayControl(1, 0, 0); 90 | sleep_ms(500); 91 | LCDdisplayControl(0, 0, 0); 92 | sleep_ms(500); 93 | LCDdisplayControl(1, 0, 0); 94 | sleep_ms(500); 95 | LCDdisplayControl(0, 0, 0); 96 | LCDclear(); 97 | LCDwriteRawMessage("+-----IMPORTANT----+"); 98 | LCDgoto("54"); 99 | LCDwriteRawMessage("+------MESSAGE-----+"); 100 | sleep_ms(100); 101 | LCDdisplayControl(1, 0, 0); 102 | break; 103 | case 5: 104 | LCDdisplayControl(0, 0, 0); 105 | LCDwriteMessage("|------IMPORTANT-MESSAGE-RECEIVED------||--------------------------------------|"); 106 | sleep_ms(500); 107 | LCDdisplayControl(1, 0, 0); 108 | sleep_ms(500); 109 | LCDdisplayControl(0, 0, 0); 110 | sleep_ms(500); 111 | LCDdisplayControl(1, 0, 0); 112 | sleep_ms(500); 113 | LCDdisplayControl(0, 0, 0); 114 | LCDclear(); 115 | LCDwriteMessage("+------IMPORTANT-MESSAGE-RECEIVED------+"); 116 | LCDdisplayControl(1, 0, 0); 117 | break; 118 | default: 119 | LCDdisplayControl(0, 0, 0); 120 | LCDwriteMessage("+---IMPORTANT--++---MESSAGE!---+"); 121 | sleep_ms(500); 122 | LCDdisplayControl(1, 0, 0); 123 | sleep_ms(500); 124 | LCDdisplayControl(0, 0, 0); 125 | sleep_ms(500); 126 | LCDdisplayControl(1, 0, 0); 127 | sleep_ms(500); 128 | LCDdisplayControl(0, 0, 0); 129 | LCDclear(); 130 | LCDwriteRawMessage("+---MESSAGE:---+"); 131 | sleep_ms(100); 132 | LCDdisplayControl(1, 0, 0); 133 | break; 134 | } 135 | } 136 | 137 | void LCDpreMessWrite(char mess[]){ 138 | switch (LCDdisplay){ 139 | case 1: 140 | if (strlen(mess) <= 16){ 141 | LCDgoto("40"); 142 | LCDwriteRawMessage(mess); 143 | } else if (strlen(mess) > 16 && strlen(mess) <= 32){ 144 | char tmp1[23]; 145 | strncpy(tmp1, mess, 16); 146 | tmp1[16] = '\0'; 147 | LCDgoto("40"); 148 | LCDwriteRawMessage(tmp1); 149 | sleep_ms(3000); 150 | LCDgoto("40"); 151 | char *tmp2 = mess + 16; 152 | LCDwriteRawMessage(tmp2); 153 | } 154 | break; 155 | case 2: 156 | if (strlen(mess) > 16 && strlen(mess) <= 32){ 157 | char tmp1[18]; 158 | strncpy(tmp1, mess, 16); 159 | tmp1[16] = '\0'; 160 | LCDgoto("40"); 161 | LCDwriteRawMessage(tmp1); 162 | LCDgoto("14"); 163 | char *tmp2 = mess + 16; 164 | LCDwriteRawMessage(tmp2); 165 | break; 166 | } else if (strlen(mess) <= 16) { 167 | LCDgoto("40"); 168 | LCDwriteRawMessage(mess); 169 | break; 170 | } else if (strlen(mess) > 32 && strlen(mess) <= 64){ 171 | char tmp1[18]; 172 | strncpy(tmp1, mess, 16); 173 | tmp1[16] = '\0'; 174 | LCDgoto("40"); 175 | LCDwriteRawMessage(tmp1); 176 | LCDgoto("14"); 177 | char *tmp2 = mess + 16; 178 | char tmp6[18]; 179 | strncpy(tmp6, tmp2, 16); 180 | tmp6[16] = '\0'; 181 | LCDwriteRawMessage(tmp6); 182 | sleep_ms(3000); 183 | char *tmp3 = mess + 32; 184 | char tmp4[23]; 185 | strncpy(tmp4, tmp3, 16); 186 | tmp4[16] = '\0'; 187 | LCDgoto("40"); 188 | LCDwriteRawMessage(tmp4); 189 | char *tmp5 = tmp3 + 16; 190 | LCDgoto("14"); 191 | LCDwriteRawMessage(tmp5); 192 | } 193 | break; 194 | case 3: 195 | if (strlen(mess) <= 20){ 196 | LCDgoto("40"); 197 | LCDwriteRawMessage(mess); 198 | } else if (strlen(mess) > 20 && strlen(mess) <= 40){ 199 | char tmp1[23]; 200 | strncpy(tmp1, mess, 20); 201 | tmp1[20] = '\0'; 202 | LCDgoto("40"); 203 | LCDwriteRawMessage(tmp1); 204 | sleep_ms(3000); 205 | LCDgoto("40"); 206 | char *tmp2 = mess + 20; 207 | LCDwriteRawMessage(tmp2); 208 | } 209 | break; 210 | case 4: 211 | if (strlen(mess) > 20 && strlen(mess) <= 40){ 212 | char tmp1[23]; 213 | strncpy(tmp1, mess, 20); 214 | tmp1[20] = '\0'; 215 | LCDgoto("40"); 216 | LCDwriteRawMessage(tmp1); 217 | LCDgoto("14"); 218 | char *tmp2 = mess + 20; 219 | LCDwriteRawMessage(tmp2); 220 | break; 221 | } else if (strlen(mess) <= 20) { 222 | LCDgoto("40"); 223 | LCDwriteRawMessage(mess); 224 | break; 225 | } else if (strlen(mess) > 40 && strlen(mess) <= 80){ 226 | char tmp1[23]; 227 | strncpy(tmp1, mess, 20); 228 | tmp1[20] = '\0'; 229 | LCDgoto("40"); 230 | LCDwriteRawMessage(tmp1); 231 | LCDgoto("14"); 232 | char *tmp2 = mess + 20; 233 | char tmp6[23]; 234 | strncpy(tmp6, tmp2, 20); 235 | tmp6[20] = '\0'; 236 | LCDwriteRawMessage(tmp6); 237 | sleep_ms(3000); 238 | char *tmp3 = mess + 40; 239 | char tmp4[23]; 240 | strncpy(tmp4, tmp3, 20); 241 | tmp4[20] = '\0'; 242 | LCDgoto("40"); 243 | LCDwriteRawMessage(tmp4); 244 | char *tmp5 = tmp3 + 20; 245 | LCDgoto("14"); 246 | LCDwriteRawMessage(tmp5); 247 | } 248 | break; 249 | case 5: 250 | if (strlen(mess) <= 40){ 251 | LCDgoto("40"); 252 | LCDwriteRawMessage(mess); 253 | } else if (strlen(mess) > 40 && strlen(mess) <= 80){ 254 | char tmp1[43]; 255 | strncpy(tmp1, mess, 40); 256 | tmp1[40] = '\0'; 257 | LCDgoto("40"); 258 | LCDwriteRawMessage(tmp1); 259 | sleep_ms(3000); 260 | LCDgoto("40"); 261 | char *tmp2 = mess + 40; 262 | LCDwriteRawMessage(tmp2); 263 | } 264 | break; 265 | default: 266 | if (strlen(mess) <= 16){ 267 | LCDgoto("40"); 268 | LCDwriteRawMessage(mess); 269 | } else if (strlen(mess) > 16 && strlen(mess) <= 32){ 270 | char tmp1[23]; 271 | strncpy(tmp1, mess, 16); 272 | tmp1[16] = '\0'; 273 | LCDgoto("40"); 274 | LCDwriteRawMessage(tmp1); 275 | sleep_ms(3000); 276 | LCDgoto("40"); 277 | char *tmp2 = mess + 16; 278 | LCDwriteRawMessage(tmp2); 279 | } 280 | break; 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /8-bit/example/presetMessages.h: -------------------------------------------------------------------------------- 1 | void LCDactivateImpMess(); 2 | void LCDpreMessWrite(); 3 | -------------------------------------------------------------------------------- /8-bit/generalOps.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "LCDops.h" 7 | 8 | /* 9 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 10 | License can be found at picoLCD/LICENSE 11 | */ 12 | 13 | extern int LCDpins[14]; 14 | 15 | void decToBin(int n){ 16 | int count = 0; 17 | char binaryTmp[9]; 18 | char binaryFinal[9] = ""; 19 | char extras = '0'; 20 | itoa(n,binaryTmp,2); 21 | count = strlen(binaryTmp); 22 | while (count < 8){ 23 | strncat(binaryFinal, &extras, 1); 24 | count++; 25 | } 26 | strcat(binaryFinal, binaryTmp); 27 | count = 0; 28 | for (int f = strlen(binaryFinal) - 1; f >= 0; f--){ 29 | if (binaryFinal[f] == '0'){ 30 | gpio_put(LCDpins[count], false); 31 | } else if (binaryFinal[f] == '1'){ 32 | gpio_put(LCDpins[count], true); 33 | } 34 | count ++; 35 | } 36 | } 37 | 38 | void binIns(char binaryFinal[]){ 39 | int count = 0; 40 | for (int f = strlen(binaryFinal) - 1; f >= 0; f--){ 41 | if (binaryFinal[f] == '0'){ 42 | gpio_put(LCDpins[count], false); 43 | } else if (binaryFinal[f] == '1'){ 44 | gpio_put(LCDpins[count], true); 45 | } 46 | count ++; 47 | } 48 | sleep_ms(3); 49 | } 50 | -------------------------------------------------------------------------------- /8-bit/generalOps.h: -------------------------------------------------------------------------------- 1 | void decToBin(int n); 2 | void binIns(char binaryFinal[]); 3 | -------------------------------------------------------------------------------- /8-bit/presetChars/presetChars.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pico/stdlib.h" 3 | #include "hardware/gpio.h" 4 | #include "pico/binary_info.h" 5 | #include "LCDops.h" 6 | 7 | /* 8 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 9 | License can be found at picoLCD/LICENSE 10 | */ 11 | 12 | void LCDactivatePreChar(int characterNum, int preset){ 13 | switch (preset){ 14 | case 1: //Music note 15 | LCDcreateCharacter(characterNum, "00000001", "00000011", "00000111", "00001101", "00001001", "00001011", "00011011", "00011000"); 16 | break; 17 | case 2: //tick 18 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00000001", "00000011", "00010110", "00011100", "00001000", "00000000"); 19 | break; 20 | case 3: //alarm bell 21 | LCDcreateCharacter(characterNum, "00000100", "00001110", "00001110", "00001110", "00001110", "00011111", "00000100", "00000000"); 22 | break; 23 | case 4: //up arrow 24 | LCDcreateCharacter(characterNum, "00000100", "00001110", "00010101", "00000100", "00000100", "00000100", "00000100", "00000000"); 25 | break; 26 | case 5: //down arroe 27 | LCDcreateCharacter(characterNum, "00000100", "00000100", "00000100", "00000100", "00010101", "00001110", "00000100", "00000000"); 28 | break; 29 | case 6: //Lock Locked 30 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00010001", "00011111", "00011011", "00011111", "00000000"); 31 | break; 32 | case 7: //Lock Unlocked 33 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00000001", "00011111", "00011011", "00011111", "00000000"); 34 | break; 35 | case 8: //Play 36 | LCDcreateCharacter(characterNum, "00000000", "00001000", "00001100", "00001110", "00001110", "00001100", "00001000", "0000000"); 37 | break; 38 | case 9: //Pause 39 | LCDcreateCharacter(characterNum, "00000000", "00011011", "00011011", "00011011", "00011011", "00011011", "00011011", "00000000"); 40 | break; 41 | case 10: //Next Track 42 | LCDcreateCharacter(characterNum, "00000000", "00001001", "00001101", "00001111", "00001111", "00001101", "00001001", "0000000"); 43 | break; 44 | case 11: //Previous Track 45 | LCDcreateCharacter(characterNum, "00000000", "00010010", "00010110", "00011110", "00011110", "00010110", "00010010", "00000000"); 46 | break; 47 | case 12: //Repeat Track 48 | LCDcreateCharacter(characterNum, "00000010", "00011111", "00010010", "00000000", "00001001", "00011111", "00001000", "00000000"); 49 | break; 50 | case 13: //Shuffle Track 51 | LCDcreateCharacter(characterNum, "00001110", "00010000", "00001110", "00000001", "00001110", "00000000", "00001010", "00010101"); 52 | break; 53 | case 14: //Muted 54 | LCDcreateCharacter(characterNum, "00010001", "00011011", "00010101", "00010001", "00010001", "00000000", "00010101", "00001010"); 55 | break; 56 | case 15: //Smiley Face 57 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00001010", "00000000", "00010001", "00001110", "00000000", "00000000"); 58 | break; 59 | case 16: //Frowny Face 60 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00001010", "00000000", "00001110", "00010001", "00000000", "00000000"); 61 | break; 62 | case 17: //Person 63 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00001110", "00000100", "00011111", "00001110", "00001110", "00000000"); 64 | break; 65 | case 18: //Heart 66 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00011111", "00011111", "00001110", "00000100", "00000000", "00000000"); 67 | break; 68 | case 19: //Battery_empty 69 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00010001", "00010001", "00011111", "00000000"); 70 | break; 71 | case 20: //Battery_1 72 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00010001", "00011111", "00011111", "00000000"); 73 | break; 74 | case 21: //Battery_2 75 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010001", "00011111", "00011111", "00011111", "00000000"); 76 | break; 77 | case 22: //Battery_3 78 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00011111", "00011111", "00011111", "00011111", "00000000"); 79 | break; 80 | case 23: //Battery_full 81 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00011111", "00011111", "00011111", "00011111", "00011111", "00000000"); 82 | break; 83 | case 24: //Battery_charging 84 | LCDcreateCharacter(characterNum, "00000100", "00011111", "00010001", "00010101", "00010101", "00010001", "00011111", "00000000"); 85 | break; 86 | case 25: //Ohm 87 | LCDcreateCharacter(characterNum, "00000000", "00001110", "00010001", "00010001", "00010001", "00001010", "00011011", "00000000"); 88 | break; 89 | case 26: //Square Root 90 | LCDcreateCharacter(characterNum, "00000000", "00000000", "00000011", "00000100", "00000100", "00010100", "00001000", "00000000"); 91 | break; 92 | case 27: //Pi 93 | LCDcreateCharacter(characterNum, "00000000", "00011111", "00001010", "00001010", "00001010", "00010011", "00000000", "00000000"); 94 | break; 95 | case 28: //:D 96 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00000000", "00011111", "00010001", "00001110", "00000000", "00000000"); 97 | break; 98 | case 29: //>:( 99 | LCDcreateCharacter(characterNum, "00010001", "00001010", "00010001", "00000100", "00000000", "00001110", "00010001", "00000000"); 100 | break; 101 | case 30: //:O 102 | LCDcreateCharacter(characterNum, "00000000", "00001010", "00000000", "00001110", "00010001", "00010001", "00001110", "00000000"); 103 | break; 104 | } 105 | } 106 | /* 107 | : // 108 | LCDcreateCharacter(characterNum, "", "", "", "", "", "", "", ""); 109 | break; 110 | case 111 | */ 112 | -------------------------------------------------------------------------------- /8-bit/presetChars/presetChars.h: -------------------------------------------------------------------------------- 1 | void LCDactivatePreChar(int characterNum, int preset); 2 | -------------------------------------------------------------------------------- /8-bit/presetMessages/presetMessages.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "pico/binary_info.h" 7 | #include "LCDops.h" 8 | #include "generalOps.h" 9 | 10 | /* 11 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 12 | License can be found at picoLCD/LICENSE 13 | */ 14 | 15 | extern int LCDpins[14]; 16 | 17 | extern int LCDdisplay; 18 | /* 19 | 0 - Not run 20 | 1 - 1602 21 | 2 - 1604 22 | 3 - 2002 23 | 4 - 2004 24 | 5 - 4002 25 | */ 26 | 27 | int lastRan = 0; 28 | 29 | void LCDactivateImpMess(){ 30 | if (LCDdisplay == 0){ 31 | detectLCD(); 32 | } 33 | LCDclear(); 34 | switch (LCDdisplay){ 35 | case 1: 36 | LCDdisplayControl(0, 0, 0); 37 | LCDwriteMessage("+---IMPORTANT--++---MESSAGE!---+"); 38 | sleep_ms(500); 39 | LCDdisplayControl(1, 0, 0); 40 | sleep_ms(500); 41 | LCDdisplayControl(0, 0, 0); 42 | sleep_ms(500); 43 | LCDdisplayControl(1, 0, 0); 44 | sleep_ms(500); 45 | LCDdisplayControl(0, 0, 0); 46 | LCDclear(); 47 | LCDwriteRawMessage("+---MESSAGE:---+"); 48 | sleep_ms(100); 49 | LCDdisplayControl(1, 0, 0); 50 | break; 51 | case 2: 52 | LCDdisplayControl(0, 0, 0); 53 | LCDwriteMessage("+--------------+| IMPORTANT || MESSAGE |+--------------+"); 54 | sleep_ms(500); 55 | LCDdisplayControl(1, 0, 0); 56 | sleep_ms(500); 57 | LCDdisplayControl(0, 0, 0); 58 | sleep_ms(500); 59 | LCDdisplayControl(1, 0, 0); 60 | sleep_ms(500); 61 | LCDdisplayControl(0, 0, 0); 62 | LCDclear(); 63 | LCDwriteRawMessage("+---IMPORTANT--+"); 64 | LCDgoto("54"); 65 | LCDwriteRawMessage("+----MESSAGE---+"); 66 | sleep_ms(100); 67 | LCDdisplayControl(1, 0, 0); 68 | break; 69 | case 3: 70 | LCDdisplayControl(0, 0, 0); 71 | LCDwriteMessage("+-----IMPORTANT----++-----MESSAGE!-----+"); 72 | sleep_ms(500); 73 | LCDdisplayControl(1, 0, 0); 74 | sleep_ms(500); 75 | LCDdisplayControl(0, 0, 0); 76 | sleep_ms(500); 77 | LCDdisplayControl(1, 0, 0); 78 | sleep_ms(500); 79 | LCDdisplayControl(0, 0, 0); 80 | LCDclear(); 81 | LCDwriteRawMessage("+-----MESSAGE:-----+"); 82 | sleep_ms(100); 83 | LCDdisplayControl(1, 0, 0); 84 | break; 85 | case 4: 86 | LCDdisplayControl(0, 0, 0); 87 | LCDwriteMessage("+------------------+| IMPORTANT || MESSAGE |+------------------+"); 88 | sleep_ms(500); 89 | LCDdisplayControl(1, 0, 0); 90 | sleep_ms(500); 91 | LCDdisplayControl(0, 0, 0); 92 | sleep_ms(500); 93 | LCDdisplayControl(1, 0, 0); 94 | sleep_ms(500); 95 | LCDdisplayControl(0, 0, 0); 96 | LCDclear(); 97 | LCDwriteRawMessage("+-----IMPORTANT----+"); 98 | LCDgoto("54"); 99 | LCDwriteRawMessage("+------MESSAGE-----+"); 100 | sleep_ms(100); 101 | LCDdisplayControl(1, 0, 0); 102 | break; 103 | case 5: 104 | LCDdisplayControl(0, 0, 0); 105 | LCDwriteMessage("|------IMPORTANT-MESSAGE-RECEIVED------||--------------------------------------|"); 106 | sleep_ms(500); 107 | LCDdisplayControl(1, 0, 0); 108 | sleep_ms(500); 109 | LCDdisplayControl(0, 0, 0); 110 | sleep_ms(500); 111 | LCDdisplayControl(1, 0, 0); 112 | sleep_ms(500); 113 | LCDdisplayControl(0, 0, 0); 114 | LCDclear(); 115 | LCDwriteMessage("+------IMPORTANT-MESSAGE-RECEIVED------+"); 116 | LCDdisplayControl(1, 0, 0); 117 | break; 118 | default: 119 | LCDdisplayControl(0, 0, 0); 120 | LCDwriteMessage("+---IMPORTANT--++---MESSAGE!---+"); 121 | sleep_ms(500); 122 | LCDdisplayControl(1, 0, 0); 123 | sleep_ms(500); 124 | LCDdisplayControl(0, 0, 0); 125 | sleep_ms(500); 126 | LCDdisplayControl(1, 0, 0); 127 | sleep_ms(500); 128 | LCDdisplayControl(0, 0, 0); 129 | LCDclear(); 130 | LCDwriteRawMessage("+---MESSAGE:---+"); 131 | sleep_ms(100); 132 | LCDdisplayControl(1, 0, 0); 133 | break; 134 | } 135 | } 136 | 137 | void LCDpreMessWrite(char mess[]){ 138 | switch (LCDdisplay){ 139 | case 1: 140 | if (strlen(mess) <= 16){ 141 | LCDgoto("40"); 142 | LCDwriteRawMessage(mess); 143 | } else if (strlen(mess) > 16 && strlen(mess) <= 32){ 144 | char tmp1[23]; 145 | strncpy(tmp1, mess, 16); 146 | tmp1[16] = '\0'; 147 | LCDgoto("40"); 148 | LCDwriteRawMessage(tmp1); 149 | sleep_ms(3000); 150 | LCDgoto("40"); 151 | char *tmp2 = mess + 16; 152 | LCDwriteRawMessage(tmp2); 153 | } 154 | break; 155 | case 2: 156 | if (strlen(mess) > 16 && strlen(mess) <= 32){ 157 | char tmp1[18]; 158 | strncpy(tmp1, mess, 16); 159 | tmp1[16] = '\0'; 160 | LCDgoto("40"); 161 | LCDwriteRawMessage(tmp1); 162 | LCDgoto("14"); 163 | char *tmp2 = mess + 16; 164 | LCDwriteRawMessage(tmp2); 165 | break; 166 | } else if (strlen(mess) <= 16) { 167 | LCDgoto("40"); 168 | LCDwriteRawMessage(mess); 169 | break; 170 | } else if (strlen(mess) > 32 && strlen(mess) <= 64){ 171 | char tmp1[18]; 172 | strncpy(tmp1, mess, 16); 173 | tmp1[16] = '\0'; 174 | LCDgoto("40"); 175 | LCDwriteRawMessage(tmp1); 176 | LCDgoto("14"); 177 | char *tmp2 = mess + 16; 178 | char tmp6[18]; 179 | strncpy(tmp6, tmp2, 16); 180 | tmp6[16] = '\0'; 181 | LCDwriteRawMessage(tmp6); 182 | sleep_ms(3000); 183 | char *tmp3 = mess + 32; 184 | char tmp4[23]; 185 | strncpy(tmp4, tmp3, 16); 186 | tmp4[16] = '\0'; 187 | LCDgoto("40"); 188 | LCDwriteRawMessage(tmp4); 189 | char *tmp5 = tmp3 + 16; 190 | LCDgoto("14"); 191 | LCDwriteRawMessage(tmp5); 192 | } 193 | break; 194 | case 3: 195 | if (strlen(mess) <= 20){ 196 | LCDgoto("40"); 197 | LCDwriteRawMessage(mess); 198 | } else if (strlen(mess) > 20 && strlen(mess) <= 40){ 199 | char tmp1[23]; 200 | strncpy(tmp1, mess, 20); 201 | tmp1[20] = '\0'; 202 | LCDgoto("40"); 203 | LCDwriteRawMessage(tmp1); 204 | sleep_ms(3000); 205 | LCDgoto("40"); 206 | char *tmp2 = mess + 20; 207 | LCDwriteRawMessage(tmp2); 208 | } 209 | break; 210 | case 4: 211 | if (strlen(mess) > 20 && strlen(mess) <= 40){ 212 | char tmp1[23]; 213 | strncpy(tmp1, mess, 20); 214 | tmp1[20] = '\0'; 215 | LCDgoto("40"); 216 | LCDwriteRawMessage(tmp1); 217 | LCDgoto("14"); 218 | char *tmp2 = mess + 20; 219 | LCDwriteRawMessage(tmp2); 220 | break; 221 | } else if (strlen(mess) <= 20) { 222 | LCDgoto("40"); 223 | LCDwriteRawMessage(mess); 224 | break; 225 | } else if (strlen(mess) > 40 && strlen(mess) <= 80){ 226 | char tmp1[23]; 227 | strncpy(tmp1, mess, 20); 228 | tmp1[20] = '\0'; 229 | LCDgoto("40"); 230 | LCDwriteRawMessage(tmp1); 231 | LCDgoto("14"); 232 | char *tmp2 = mess + 20; 233 | char tmp6[23]; 234 | strncpy(tmp6, tmp2, 20); 235 | tmp6[20] = '\0'; 236 | LCDwriteRawMessage(tmp6); 237 | sleep_ms(3000); 238 | char *tmp3 = mess + 40; 239 | char tmp4[23]; 240 | strncpy(tmp4, tmp3, 20); 241 | tmp4[20] = '\0'; 242 | LCDgoto("40"); 243 | LCDwriteRawMessage(tmp4); 244 | char *tmp5 = tmp3 + 20; 245 | LCDgoto("14"); 246 | LCDwriteRawMessage(tmp5); 247 | } 248 | break; 249 | case 5: 250 | if (strlen(mess) <= 40){ 251 | LCDgoto("40"); 252 | LCDwriteRawMessage(mess); 253 | } else if (strlen(mess) > 40 && strlen(mess) <= 80){ 254 | char tmp1[43]; 255 | strncpy(tmp1, mess, 40); 256 | tmp1[40] = '\0'; 257 | LCDgoto("40"); 258 | LCDwriteRawMessage(tmp1); 259 | sleep_ms(3000); 260 | LCDgoto("40"); 261 | char *tmp2 = mess + 40; 262 | LCDwriteRawMessage(tmp2); 263 | } 264 | break; 265 | default: 266 | if (strlen(mess) <= 16){ 267 | LCDgoto("40"); 268 | LCDwriteRawMessage(mess); 269 | } else if (strlen(mess) > 16 && strlen(mess) <= 32){ 270 | char tmp1[23]; 271 | strncpy(tmp1, mess, 16); 272 | tmp1[16] = '\0'; 273 | LCDgoto("40"); 274 | LCDwriteRawMessage(tmp1); 275 | sleep_ms(3000); 276 | LCDgoto("40"); 277 | char *tmp2 = mess + 16; 278 | LCDwriteRawMessage(tmp2); 279 | } 280 | break; 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /8-bit/presetMessages/presetMessages.h: -------------------------------------------------------------------------------- 1 | void LCDactivateImpMess(); 2 | void LCDpreMessWrite(); 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## V0.5.0 2 | 3 | Added `presetMessages` base code 4 | 5 | Re-structured the 8-bit folder 6 | 7 | Update README.md and FUNCTIONS.md 8 | 9 | Improved LCD size autodetection for line wrapping and preset Messages 10 | -------------------------------------------------------------------------------- /FUNCTIONS.md: -------------------------------------------------------------------------------- 1 | ## Standard Functions 2 | 3 | `LCDinit()` - initializes the Display 4 | 5 | `LCDclear()` - clears all lines on LCD 6 | 7 | `LCDgoto(char hexString[])` - goes to the character at the hexadecimal DDRAM address specified (no 0x) 8 | 9 | `LCDwriteMessage(char message[])` - writes the message to the LCD screen, takes a string max. 80 characters. Also tries to wrap the message automatically to the next line by detecting 10 | the screen size. 11 | 12 | `LCDwriteRawMessage(char message[])` - writes the message to the display, but with no text wrapping/display detection. 13 | 14 | `LCDsendRawInstruction(int RS_PIN, int RW_PIN, char binary[])` - sends binary data directly to the screen. Takes the state of the Instruction/Data pin, Read/Write pin and the binary itself. 15 | 16 | `LCDwriteAscii(int characterCodeInDecimal)` - Writes 1 character based off the character code. 17 | 18 | `LCDdisplayControl(int display, int cursor, int blink)` - Controls the display. 19 | 20 | Display: 0 - OFF, 1 - ON 21 | 22 | Cursor: 0 - OFF, 1 - ON 23 | 24 | (Cursor)Blink: 0 - OFF, 1 - ON 25 | 26 | `LCDcreateCharacter(int charnum, char line1[], char line2[], char line3[], char line4[], char line5[], char line6[], char line7[], char line8[])` 27 | 28 | LCDwcreateCharacter creates custom characters for you to use easily later on. The HD44780 supports up to 8 custom characters. 29 | 30 | ***Please Note***: After you have run this function, you must move the cursor using LCDgoto() before doing anything else (except if creating multiple custom characters in a row. you will only have to move the cursor after creating all characters). 31 | 32 | There are two ways to accomplish this: 33 | 34 | 1. Create all characters needed between `LCDinit()` and `LCDclear()` as `LCDclear()` always resets the cursor to 0x00 35 | 36 | ![creating characters between two functions](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/customCharacter1.png) 37 | 38 | 2. Move cursor manually between creating a custom character and displaying it. 39 | 40 | ![moving cursor after creating character](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/customCharacter2.png) 41 | 42 | `int charnum` = 1 - 8, defines which custom character is being written to 43 | 44 | `line1[]` -> `line8[]` = The 8 lines of the custom character in binary. 45 | 46 | Each custom character is 5x8, so each `line*[]` is the eight lines needed. 47 | 48 | **Example** 49 | 50 | line1[] - (000)| 0 | 0 | **1** | 0 | 0 | 51 | 52 | line2[] - (000)| 0 | **1** | **1** | **1** | 0 | 53 | 54 | line3[] - (000)| 0 | **1** | **1** | **1** | 0 | 55 | 56 | line4[] - (000)| 0 | **1** | **1** | **1** | 0 | 57 | 58 | line5[] - (000)| 0 | **1** | **1** | **1** | 0 | 59 | 60 | line6[] - (000)| **1** | **1** | **1** | **1** | **1** | 61 | 62 | line7[] - (000)| 0 | 0 | **1** | 0 | 0 | 63 | 64 | line8[] - (000)| 0 | 0 | 0 | 0 | 0 | 65 | 66 | (0 - pixel is off, 1 - pixel is on) 67 | 68 | Gives us this: 69 | 70 | `LCDcreateCharacter(2, "00000100", "00001110", "00001110", "00001110", "00001110", "00011111", "00000100", "00000000");` 71 | 72 | Which creates this: 73 | 74 | ![a small bell](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/bell.jpg) 75 | 76 | 77 | `LCDwriteCustomCharacter(int characterNum)` - Writes the custom character specified. (1 - 8) 78 | 79 | `void LCDshiftDisplay(int rl)` - Shift display based on `rl` (0 - left, 1 - right) 80 | 81 | `void LCDshiftCursor(int rl)` - Shift cursor based on `rl` (0 - left, 1 - right) 82 | 83 | ## Pre-Designed Custom Characters 84 | 85 | **If you would like to use the following, please also add `#include presetChars.h` to your main.c and `presetChars.c` to your `add_executable()` in CMakeLists.txt** 86 | 87 | `LCDactivatePreChar(int characterNum, int preset)` - Activates one of the pre-designed characters and writes it to a custom character slot. 88 | 89 | **Please Note**: While these are displayed using `LCDwriteCustomCharacter` like all custom characters, these also require moving the cursor after activating them. See note in `LCDwriteCustomCharacter` for more details 90 | 91 | `characterNum` = 1-8, the custom character slot 92 | 93 | `preset` = The preset custom character you want to activate as shown below (1-30) 94 | 95 | ![preset characters 1-8](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/preset1.jpg) 96 | 97 | ![preset character 9-16](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/preset2.jpg) 98 | 99 | ![preset character 17-24](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/preset3.jpg) 100 | 101 | ![preset character 24-30](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/preset4.jpg) 102 | 103 | 1 - Music 104 | 105 | 2 - Check 106 | 107 | 3 - Alarm bell 108 | 109 | 4 - Up 110 | 111 | 5 - Down 112 | 113 | 6 - Locked 114 | 115 | 7 - Unlocked 116 | 117 | 8 - Play 118 | 119 | 9 - Paused 120 | 121 | 10 - Next Song 122 | 123 | 11 - Previous Song 124 | 125 | 12 - Repeat On 126 | 127 | 13 - Shuffle On 128 | 129 | 14 - Mute On 130 | 131 | 15 - :) 132 | 133 | 16 - :( 134 | 135 | 17 - Person 136 | 137 | 18 - Heart 138 | 139 | 19 - Battery_empty 140 | 141 | 20 - Battery_1 142 | 143 | 21 - Battery_2 144 | 145 | 22 - Battery_3 146 | 147 | 23 - Battery_full 148 | 149 | 24 - Battery_charging 150 | 151 | 25 - Ohm 152 | 153 | 26 - Square Root 154 | 155 | 27 - Pi 156 | 157 | 28 - :D 158 | 159 | 29 - >:( 160 | 161 | 30 - :O 162 | 163 | ## Preset Messages 164 | 165 | **If you would like to use the following, please also add `#include presetMessages.h` to your main.c and `presetMessages.c` to your `add_executable()` in CMakeLists.txt** 166 | 167 | `LCDactivateImpMess()` - Activates the "Important Message Recieved" preset. This automatically detects LCD screen size and outputs appropriate sized message. If an unsupported LCD is detected, defaults to 16x2. 168 | 169 | `LCDpreMessWrite(char mess[])` - Writes the actual message inside the last activated preset. 170 | 171 | To calculate the amount of text you can write, you multiply the number of lines by line length (e.g for a 20x4 screen you can write up to 80 characters). If the message is long enough, the function auto wraps and auto switches to the second half of the message after 3 seconds of showing the first half. 172 | 173 | The message should be one whole string passed to the function. 174 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # picoLCD 2 | 3 | ## About picoLCD 4 | picoLCD is a collection of functions to make interfacing with HD44780 (and other pin & instruction compatible chips such as the Sitronix ST7066) based LCD screens easier on the Raspberry Pi Pico. Rather than reading through data sheets to figure out the correct set of instructions to send to the screen, picoLCD attempts to make it a simpler process, while still being extremely versatile. It's as simple as copying the `.c & .h` files to your project, add some `#include`s, set some pins and off you go! 5 | 6 | This is still very much a work in progress. 7 | This is known to work on the following LCD sizes in 8-bit mode: 8 | 9 | ![16x2 status](https://img.shields.io/badge/16x2-Tested-brightgreen) (HD44780) 10 | 11 | ![20x4 status](https://img.shields.io/badge/20x4-Tested-brightgreen) (HD44780) 12 | 13 | ![40x2 status](https://img.shields.io/badge/40x2-Tested-brightgreen) (ST7066) 14 | 15 | ![16x4 status](https://img.shields.io/badge/16x4-Untested-red) 16 | 17 | ![8x2 status](https://img.shields.io/badge/8x2-Untested-red) 18 | 19 | 4-bit operation is also on the way once more progress is done on the current version. 20 | 21 | Basic Instructions are below, with more detailed function documentation in 'picoLCD/FUNCTIONS.md' 22 | 23 | Demo .uf2 files can be found at `picoLCD/demos`. 24 | 25 | Current Version = 0.5.0 26 | 27 | Changelog can be found at `picoLCD/CHANGELOG.md`. 28 | 29 | ### Wiring the pico 30 | 31 | The Pico should be wired to the LCD as follows for 8-bit operation, with the Pico being plugged 32 | into USB: 33 | 34 | ![diagram depicting the wiring of the LCD to the PICO](https://raw.githubusercontent.com/zadi15/picoLCD/main/imgs/picoLCD.png) 35 | 36 | Please note the LCD backlight should be powered by an external 5v power source, as the Pico may not be able to power both the LCD and 37 | backlight. 38 | 39 | ## Basic Usage: 40 | 41 | **Please Note: This describes the minimum steps needed to get an LCD functioning. An example `main.c` can be found at `picoLCD/8-bit/example`. Use of the more advanced features are detailed below.** 42 | 43 | To get started all you need to do is move all `.c & .h` files (found at either `picoLCD/8-bit` for 8-bit operation) to your project folder, and do the following: 44 | 45 | At the top of your main file add the following `#include`s: 46 | 47 |
 48 | #include "pico/binary_info.h"
 49 | #include "LCDops.h"
 50 | #include "generalOps.h"
 51 | 
52 | 53 | Additionally, you need to declare which GPIOs the LCD is connected to and the LCD size (Make sure these are not in `main()`). The example below is for a 16x2 LCD connected as in the above diagram. 54 | 55 | {D0,D1,D2,D3,D4,D5,D6,D7, E , RS , RW , LCD Line Length (eg. 16 characters across), Number of Lines on LCD} 56 | 57 | `int LCDpins[14] = {0,1,2,3,4,5,6,7,15,16,17,16,2};` 58 | 59 | Finally these pins that we just defined (excluding the LCD line length and line count values) need to be initialized, set as output and pulled low. Here is an example: 60 | 61 |
 62 | for(int gpio = 0; gpio < 11; gpio++){
 63 |     gpio_init(LCDpins[gpio]);
 64 |     gpio_set_dir(LCDpins[gpio], true);
 65 |     gpio_put(LCDpins[gpio], false);
 66 | }
 67 | 
68 | 69 | And inside your `CMakeLists.txt`, add `LCDops.c` and `generalOps.c` to your `add_executable()` e.g. 70 | 71 |
 72 | add_executable(project
 73 |     main.c
 74 |     LCDops.c
 75 |     generalOps.c
 76 | )
 77 | 
78 | 79 | You're now able to use picoLCD's functions as explained in `picoLCD/FUNCTIONS.md`! 80 | 81 | ### Advanced Features 82 | 83 | **Included Custom Characters** 84 | 85 | If you want to use the set of pre-designed custom characters this library provides, detailed in `FUNCTIONS.md`, you must also: 86 | 87 | Move the `.c` and `.h` files found at `picoLCD/8-bit/presetChars/` to your project folder 88 | 89 | Add `#include presetChars.h` to your main.c and `presetChars.c` to your `add_executable()` in CMakeLists.txt. 90 | 91 | 92 | **Custom Message Presets** 93 | 94 | If you want to use the set of pre-designed custom message functions this library provides, detailed in `FUNCTIONS.md`, you must also: 95 | 96 | Move the `.c` and `.h` files found at `picoLCD/8-bit/presetMessages/` to your project folder 97 | 98 | Add `#include presetMessages.h` to your main.c and `presetMessages.c` to your `add_executable()` in CMakeLists.txt. 99 | 100 | 101 | ## To Do 102 | 103 | --> Clean up FUNCTIONS.md 104 | 105 | --> Continue adding LCD functions 106 | 107 | --> Expand custom characters 108 | 109 | --> Secret additions :D 110 | -------------------------------------------------------------------------------- /demos/20x4/customChars.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/demos/20x4/customChars.uf2 -------------------------------------------------------------------------------- /demos/20x4/src/customChars/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pico/stdlib.h" 3 | #include "hardware/gpio.h" 4 | #include "pico/binary_info.h" 5 | #include "LCDops.h" 6 | #include "generalOps.h" 7 | #include "presetChars.h" 8 | 9 | /* 10 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 11 | License can be found at picoLCD/LICENSE 12 | */ 13 | 14 | int LCDpins[14] = {0,1,2,3,4,5,6,7,15,16,17,20,4}; 15 | 16 | int main(){ 17 | bi_decl(bi_program_description("This is a work-in-progress example of interfacing with LCD Displays using HD44780 chips on the Raspberry Pi Pico!")); 18 | 19 | stdio_init_all(); 20 | 21 | //Initialize all needed pins as defined in LCDpins, set them as 22 | // outputs and then pull them low 23 | for(int gpio = 0; gpio < 11; gpio++){ 24 | gpio_init(LCDpins[gpio]); 25 | gpio_set_dir(LCDpins[gpio], true); 26 | gpio_put(LCDpins[gpio], false); 27 | } 28 | 29 | //Initialize and clear the LCD, prepping it for characters / instructions 30 | LCDinit(); 31 | LCDclear(); 32 | sleep_ms(8); 33 | LCDactivatePreChar(1, 1); 34 | LCDactivatePreChar(2, 2); 35 | LCDactivatePreChar(3, 3); 36 | LCDactivatePreChar(4, 4); 37 | LCDactivatePreChar(5, 5); 38 | LCDactivatePreChar(6, 6); 39 | LCDactivatePreChar(7, 7); 40 | LCDactivatePreChar(8, 8); 41 | LCDgoto("00"); 42 | LCDwriteMessage("1 2 3 4 5 6 7 8"); 43 | LCDgoto("40"); 44 | LCDwriteCustomCharacter(1); 45 | LCDwriteAscii(32); 46 | LCDwriteCustomCharacter(2); 47 | LCDwriteAscii(32); 48 | LCDwriteCustomCharacter(3); 49 | LCDwriteAscii(32); 50 | LCDwriteCustomCharacter(4); 51 | LCDwriteAscii(32); 52 | LCDwriteCustomCharacter(5); 53 | LCDwriteAscii(32); 54 | LCDwriteCustomCharacter(6); 55 | LCDwriteAscii(32); 56 | LCDwriteCustomCharacter(7); 57 | LCDwriteAscii(32); 58 | LCDwriteCustomCharacter(8); 59 | LCDwriteAscii(32); 60 | sleep_ms(5000); 61 | LCDactivatePreChar(1, 9); 62 | LCDactivatePreChar(2, 10); 63 | LCDactivatePreChar(3, 11); 64 | LCDactivatePreChar(4, 12); 65 | LCDactivatePreChar(5, 13); 66 | LCDactivatePreChar(6, 14); 67 | LCDactivatePreChar(7, 15); 68 | LCDactivatePreChar(8, 16); 69 | LCDgoto("00"); 70 | LCDwriteMessage("9 10111213141516"); 71 | LCDgoto("40"); 72 | LCDwriteCustomCharacter(1); 73 | LCDwriteAscii(32); 74 | LCDwriteCustomCharacter(2); 75 | LCDwriteAscii(32); 76 | LCDwriteCustomCharacter(3); 77 | LCDwriteAscii(32); 78 | LCDwriteCustomCharacter(4); 79 | LCDwriteAscii(32); 80 | LCDwriteCustomCharacter(5); 81 | LCDwriteAscii(32); 82 | LCDwriteCustomCharacter(6); 83 | LCDwriteAscii(32); 84 | LCDwriteCustomCharacter(7); 85 | LCDwriteAscii(32); 86 | LCDwriteCustomCharacter(8); 87 | LCDwriteAscii(32); 88 | sleep_ms(5000); 89 | LCDactivatePreChar(1, 17); 90 | LCDactivatePreChar(2, 18); 91 | LCDactivatePreChar(3, 19); 92 | LCDactivatePreChar(4, 20); 93 | LCDactivatePreChar(5, 21); 94 | LCDactivatePreChar(6, 22); 95 | LCDactivatePreChar(7, 23); 96 | LCDactivatePreChar(8, 24); 97 | LCDgoto("00"); 98 | LCDwriteMessage("1718192021222324"); 99 | LCDgoto("40"); 100 | LCDwriteCustomCharacter(1); 101 | LCDwriteAscii(32); 102 | LCDwriteCustomCharacter(2); 103 | LCDwriteAscii(32); 104 | LCDwriteCustomCharacter(3); 105 | LCDwriteAscii(32); 106 | LCDwriteCustomCharacter(4); 107 | LCDwriteAscii(32); 108 | LCDwriteCustomCharacter(5); 109 | LCDwriteAscii(32); 110 | LCDwriteCustomCharacter(6); 111 | LCDwriteAscii(32); 112 | LCDwriteCustomCharacter(7); 113 | LCDwriteAscii(32); 114 | LCDwriteCustomCharacter(8); 115 | LCDwriteAscii(32); 116 | sleep_ms(5000); 117 | LCDactivatePreChar(1, 25); 118 | LCDactivatePreChar(2, 26); 119 | LCDactivatePreChar(3, 27); 120 | LCDactivatePreChar(4, 28); 121 | LCDactivatePreChar(5, 29); 122 | LCDactivatePreChar(6, 30); 123 | LCDgoto("00"); 124 | LCDwriteMessage("252627282930 "); 125 | LCDgoto("40"); 126 | LCDwriteCustomCharacter(1); 127 | LCDwriteAscii(32); 128 | LCDwriteCustomCharacter(2); 129 | LCDwriteAscii(32); 130 | LCDwriteCustomCharacter(3); 131 | LCDwriteAscii(32); 132 | LCDwriteCustomCharacter(4); 133 | LCDwriteAscii(32); 134 | LCDwriteCustomCharacter(5); 135 | LCDwriteAscii(32); 136 | LCDwriteCustomCharacter(6); 137 | LCDwriteAscii(32); 138 | LCDwriteAscii(32); 139 | LCDwriteAscii(32); 140 | LCDwriteAscii(32); 141 | LCDwriteAscii(32); 142 | } 143 | -------------------------------------------------------------------------------- /demos/40x2/demoText.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/demos/40x2/demoText.uf2 -------------------------------------------------------------------------------- /demos/40x2/src/demoText/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pico/stdlib.h" 3 | #include "hardware/gpio.h" 4 | #include "pico/binary_info.h" 5 | #include "LCDops.h" 6 | #include "generalOps.h" 7 | #include "presetChars.h" 8 | /* 9 | Copyright (c) 2021, zadi15 (https://github.com/zadi15/) 10 | License can be found at picoLCD/LICENSE 11 | */ 12 | 13 | int LCDpins[14] = {0,1,2,3,4,5,6,7,15,16,17,40,2}; 14 | 15 | int main(){ 16 | bi_decl(bi_program_description("This is a work-in-progress example of interfacing with LCD Displays using HD44780 chips on the Raspberry Pi Pico!")); 17 | 18 | stdio_init_all(); 19 | 20 | //Initialize all needed pins as defined in LCDpins, set them as 21 | // outputs and then pull them low 22 | for(int gpio = 0; gpio < 11; gpio++){ 23 | gpio_init(LCDpins[gpio]); 24 | gpio_set_dir(LCDpins[gpio], true); 25 | gpio_put(LCDpins[gpio], false); 26 | } 27 | 28 | //Initialize and clear the LCD, prepping it for characters / instructions 29 | LCDinit(); 30 | LCDclear(); 31 | sleep_ms(8); 32 | LCDgoto("00"); 33 | LCDsendRawInstruction(0,0,"00001100"); 34 | //A few examples of function usage 35 | char message[81] = "This is a work-in-progress example of interfacing with LCD Displays using a Pico"; 36 | LCDwriteMessage(message); 37 | } 38 | -------------------------------------------------------------------------------- /imgs/40x2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/40x2.jpg -------------------------------------------------------------------------------- /imgs/LCD.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/LCD.jpg -------------------------------------------------------------------------------- /imgs/bell.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/bell.jpg -------------------------------------------------------------------------------- /imgs/customCharacter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/customCharacter1.png -------------------------------------------------------------------------------- /imgs/customCharacter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/customCharacter2.png -------------------------------------------------------------------------------- /imgs/picoLCD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/picoLCD.png -------------------------------------------------------------------------------- /imgs/preset1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/preset1.jpg -------------------------------------------------------------------------------- /imgs/preset2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/preset2.jpg -------------------------------------------------------------------------------- /imgs/preset3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/preset3.jpg -------------------------------------------------------------------------------- /imgs/preset4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/preset4.jpg -------------------------------------------------------------------------------- /imgs/screen_low.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zadi15/picoLCD/cbb202e64884b6de51aebb7f5c834a37614627eb/imgs/screen_low.gif --------------------------------------------------------------------------------