Hi, I have been trying to follow your video and code but I keep getting error messages, can you help please? This is the code and error message. void setup() { #define RST 12 #define CE 11 #define DC 10 #define DIN 9 #define CLK 8 #include "font.h"; voidLcdWriteString(char*characters) { while(*characters)LcdWriteCharacter(*characters++) } voidLcdWriteCharacter(charcharacter) { for(inti=0; i
Hey, do you know if it's possible to translate this code to python? I only know a little bit of Python and an even smaller amount of C#, not to mention I'll be hooking this up to a Raspberry Pi
Julian, Thank you - i am a hardware man and I have used Arduino before without actually understanding how some of the code is derived, in this case, from the data sheet. Very useful. Alan
Indeed. keep up the good work! (I'm looking at getting a Gamebuino, which I guess uses this exact same screen, if I do, and feel like controlling it manually, I might keep these video handy for reference)
10:30 Yes They are Pointers :) Pointers to characters of string type :D You're video is amazing!! It is greatly appreciated. Thank you soo much for taking time to make this!
You put me nostalgic with this tutorial remembering my beginnings on reading binary, mentally convert to decimal....but to hexa I needed the calculator :D Nice video....VERY useful for me.
*var means var is a pointer that you are dereferencing - i.e. access the data that var points to. It's the inverse of &var, which takes the address of the data . So: int a = 10; int* b = &a; //bis now the pointer to a *b = 5; // changes the value of a to 5
Graham, thanks for that very timely piece of advice. I kind of get pointers, but as with all new things, getting to grips with the jargon is the hardest part. Dereferencing means nothing to me, I'll look it up. But I can see how modifying *b actually modifies a. Cheers.
Julian Ilett Dereferencing just means "follow the pointer to the data it points to". If you know any assembler (as a hardware person you may well do!) it's like an indirect addressing mode, and if that means nothing then don't sweat it, most C programmers have no idea what these language features turn into when compiled. Actually my example is slightly wrong, or the wording is. To declare a pointer to a variable of type , you write var* (i.e. the * follows the type), as I've written int* b. To dereference the pointer (access the data it points to), you write *, i.e. the * precedes the name, as in *b = 5; Hope that makes sense, but I'm sure any C text will be far clearer than my explanation. BTW thanks for an interesting tutorial, I've done a bit with Arduino but nothing as sophisticated.
Regarding DRY, I would suggest you have three functions: lcdWrite, lcdWriteCommand and lcdWriteData. The nicely-named functions simply call the underlying lcdWrite function with an appropriate flag set. Violating DRY is asking always inviting trouble. Thanks for the very helpful video!
It's a lot more fun to see this and try to interface an Arduino with a 5110 myself than using one of those pre-made classes. This way, I feel like I learn a lot more about what I'm actually doing. Great tutorial videos, thanks Julian! As a final tip, for sharing code, I suggest pastebin.com or any other code-snippet website. Those websites add syntax highlighting colours and make sure the indentation is preserved! :)
Nice code, Julian! I fought for hours with SparkFun's code. Your's is easy easy to understand and cleaner. Had my screen up and running in minutes! Next, going to see if I can pull in the LCD_Functions library to use the drawing tools there... unless you have code for that, too??!
Hi Julian, great job as always! Your guess was correct, * means pointer in C and C++. A C string is represented as a char pointer, which basically points to the memory address of the first character in your string and ends with the ASCII 0 character, which is the string null terminator character.
For those of you getting "stray \357" etc etc etc errors, I think it's because the code was pasted with a different character encoding. I copy/pasted the same font from the Arduino website and then manually corrected the lines with the errors in the INO and it compiled.
The arficacts after reset may occur because you probably are not using logic level shifting. There are also different PCB versions of this Nokia modula - some can be powered with 5V, some not.
Hi Julian, first of all thanks for your very informative videos which I enjoy immensely. Regarding this Nokia LCD, I like yourself, like a challenge and enjoy programming a lot, but surely there must be an Arduino library out here which would reduce the amount of hands on code bashing required to program it? Keep up the good work!
You could shorten the overall code by having LCDWriteCmd call LCDWriteData with a parameter for that defaults to high, but your Cmd function sets it to low? Appologies if this has been mentioned before or doesn't really work. I'm still waiting for my hardware to arrive, but I'm reading up and watching vids. Yours are excellent! :-)
Can I get some help on how to send a 'int' or 'float" variable to be displayed on the screen. I know it's not that complicated but I am having trouble imagining a way to do it.
Hi Julian I understand you can put14 characters on each row, (14x6) which command do I use to position the character. example I what to put a letter "A" in the second line 5th position over.
Congrats Julian, it's amazing how clear you are during your explanation. I did really appreciate your video. One question: In my experience when I try to light the upper left dots using the 0x55 and 0xaa commands, in my LCD, they are not displayed exactly at the upper left position of the display, but in almost end of the first line. Do u have a clue for that? Thanks again,
Thank-you. I got my nokia 5110 working with my TI MSP430 Launchpad using energia. Same code, same pinout. The only change I made was I didn't make the font.h file, I just pasted the ASCII array into my main code right under the define statements and removed the include "font.h"
Hey Julian. These are great vids! Programming the 5110 at a core level is something I haven't seen yet. I just take the easy path using the Adafruit 5110 library :) Cheers!
Thanks Eric. I couldn't find a video about programming this display from bit level upwards, so I thought I'd have a go myself. At some point, I fancy having a go at writing a library - maybe I'll write one for the 5110, or perhaps the 128x64 OLED.
I have the font.h attached as you show. However, I'm getting this error. It's not seeing the ASCII from the font.h file. Nokia_5110_tutorial.ino: In function 'void LcdWriteCharacter(char)': Nokia_5110_tutorial:15: error: 'ASCII' was not declared in this scope
Hello Mister Ilett, I copied your code and also included the font.h data but I still get error massages. For Example expected ',' or ';' before 'void' void LcdWriteCharacter(char character) ^ I tried fixing this for a long time but I don't know how. Can you help me out? Bloody beginner btw. Thanks for the great videos and good explanations!
Hi, the code works great, but I`ve got one problem: "The End" stands on the display for around 0,1 sec, aber this the whole display is full with black pixels. What`s the problem? Thanks a million...
MilosMaric1982 Try changing contrast value in this line of code: LcdWriteCmd(0xBF); // set LCD Vop (contrast) 0xB0 works for me, with 0xBF I can still see the letters, but the screen is almost black around them.
What are your thoughts on using the screen to display 2 large digits, and possibly a direction indicator? Would I need to write custom code to compose the entire screen image in an array and then send that serially?
Creating entire screen images isn't practical - you'd need 100 of them to encode all combinations of your 2 digits. You can cut that down to 10 by encoding each digit separately.
Thank you Mr Ilett! 1st part was very easy to understand, but in the 2nd part I have a problem as many people here (I guess). Does not matter how I lower the screen contrast, it still remains lit fully but not dark as before. Even I can not to display "55" and "AA". Could you please help me?
I keep on getting this error message: Arduino: 1.8.1 Hourly Build 2016/12/24 01:12 (Mac OS X), Board: "Arduino/Genuino Uno" In file included from /Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino:7:0: font.h:101: error: stray '\357' in program }; ^ font.h:101: error: stray '\273' in program font.h:101: error: stray '\277' in program /Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino: In function 'void setup()': /Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino:48:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] LcdWriteStng("Hi, My Name Is Theo"); ^ exit status 1 stray '\357' in program This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
Firstly, thanks for all the superb videos, and your infectious enthusiasm. It infected me greatly. I know you're a busy chap, but I wondered if you could help me with a particularly tenacious compiling error. I followed (many times) parts 1 and 2 of your 5110 tutorials, and copied and pasted your code from this forum, but continue to get this straightforward error: Nokia5110_2_5:10: error: expected ',' or ';' before 'void' from this code: #include "font.h"; void LcdWriteString(char *characters) { while(*characters) LcdWriteCharacter(*characters++); } It all looked fine to me, but I tried inserting and removing semicolons anyway, without joy. Could it be something to do with different versions of Arduino software or Nano version? My Nano is V3.0, and I'm using Arduino 1.0.5. I even checked for non printing characters in the text, but that looked clean. I searched for the error and followed the pointers, but it all looks as it should to my relatively untrained eye. I have rtfm, so to speak. I'd be very grateful for any advice you may be able to give me. Regards, Mike Adams
Michael, I had the same issue and found the solution to be inside the font header file itself. If you tried to copy the font.h file from this page, try deleting the final semi-colon in the file, which is at the bottom of the file directly following the curly bracket. Press enter to obtain a new line and then type a semi-colon and it should then compile without error.
I have bee following along from the first video and was able to get all the pixels to lite, but now on the second video I inserted the (0x0C) to put the display back to normal and no matter what I do the display stays with all pixels lit
I would suggest instead of having comments for every command write that you define the commands and modifier bits and use them like CMD_DISPMODE | DISPMODE_NORMAL ... that way the meaning is in the code. :) Pointers are one of the most useful features in C especially when fiddling with memory mapped stuff. You can use a pointer like an array.. you can have pointers to pointers.. fun stuff :)
I was about to ask for the font.h file but I found a copy elsewhere. If anyone else needed the font.h file look here playground.arduino.cc/Code/PCD8544
I found this very helpful, Julian. If you want a simple intro to pointers, see my article: www.drdobbs.com/cpp/computer-programming-and-precise-termino/208808373 After reading that, a valid pointer has an rvalue that is a memory address (or null). The indirection operator (*) simply says: "Go to the memory address and fetch what's there." The address of operator (&) simply says: "Fetch the address of where this variable is stored in memory." So, in the following code fragment: int val = 10; int *iptr; char name[] = "Jack"; char *cptr; iptr = &val; cptr = name; Suppose val exists in memory at address 1000 and name is at 2000. The statement iptr = &val make the rvalue of iptr equal to 1000. The statement printf(*iptr); would say: "Get the rvalue of iptr (i.e., 1000), go to that address and fetch "int" bytes (2 bytes) of data, and then print those two bytes (10)". In C, an array name is the same as the array's lvalue, so cptr = name is syntactically the same as cptr = &name[0]. In a totally biased plug, take a look at Beginning C for Arduino on Amazon.com. You can click on the cover and "look inside" to see the Table of Contents...there are two chapters on pointers.
Here's the Arduino code listing:
#define RST 12
#define CE 11
#define DC 10
#define DIN 9
#define CLK 8
#include "font.h";
void LcdWriteString(char *characters)
{
while(*characters) LcdWriteCharacter(*characters++);
}
void LcdWriteCharacter(char character)
{
for(int i=0; i
If I needed to display a variable that is a number how would I do That using this code? I am just starting with setting these up!
Futz With I figured it out!
Later, FW!
Hi, I have been trying to follow your video and code but I keep getting error messages, can you help please? This is the code and error message. void setup() {
#define RST 12
#define CE 11
#define DC 10
#define DIN 9
#define CLK 8
#include "font.h";
voidLcdWriteString(char*characters)
{
while(*characters)LcdWriteCharacter(*characters++)
}
voidLcdWriteCharacter(charcharacter)
{
for(inti=0; i
Richard Green... try to delete... void setup() ... before define
Hey, do you know if it's possible to translate this code to python? I only know a little bit of Python and an even smaller amount of C#, not to mention I'll be hooking this up to a Raspberry Pi
I think this is one of the most clear presentations I have ever seen! Compliments!!!
Thanks Hans
I really like Julian's Arduino explorations. He talks just like a British airline pilot :)
And here's the font data:
#include
static const byte ASCII[][5] =
{
{0x00, 0x00, 0x00, 0x00, 0x00} // 20
,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f /
,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c ¥
,{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
,{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
,{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
,{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
,{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
,{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
,{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
,{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
,{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
,{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
,{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
,{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
,{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
,{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j
,{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
,{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
,{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
,{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
,{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
,{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
,{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
,{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
,{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
,{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
,{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
,{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
,{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
,{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
,{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
,{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
,{0x00, 0x08, 0x36, 0x41, 0x00} // 7b {
,{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
,{0x00, 0x41, 0x36, 0x08, 0x00} // 7d }
,{0x10, 0x08, 0x08, 0x10, 0x08} // 7e ←
,{0x78, 0x46, 0x41, 0x46, 0x78} // 7f →
};
But...
How do i Make it an .h File?
and Where do i Place it to be able to import it?
Brandon Ruiz Vasquez Hey thats not necessary just copy the font data for #include ........to.....}; .Then it worked fine for me
Brandon Ruiz Vasquez In the same folder as the .ino file.
Revisa, has pegado mal los datos :D
Walter Brayan Castillo Alayo a mi no me funciona, qué es el problema?
Julian,
Thank you - i am a hardware man and I have used Arduino before without actually understanding how some of the code is derived, in this case, from the data sheet. Very useful.
Alan
pretty impressive video. I've never manually controlled an LCD before, but this was interesting to watch.
Thank you kindly.
Indeed. keep up the good work! (I'm looking at getting a Gamebuino, which I guess uses this exact same screen, if I do, and feel like controlling it manually, I might keep these video handy for reference)
10:30 Yes They are Pointers :) Pointers to characters of string type :D You're video is amazing!! It is greatly appreciated. Thank you soo much for taking time to make this!
You put me nostalgic with this tutorial remembering my beginnings on reading binary, mentally convert to decimal....but to hexa I needed the calculator :D Nice video....VERY useful for me.
Thank you for video. I've got my screen up and running. Actually it's thanks to your video that I bought the screen ;-) Keep up the good work!
*var means var is a pointer that you are dereferencing - i.e. access the data that var points to. It's the inverse of &var, which takes the address of the data . So:
int a = 10;
int* b = &a; //bis now the pointer to a
*b = 5; // changes the value of a to 5
Graham, thanks for that very timely piece of advice. I kind of get pointers, but as with all new things, getting to grips with the jargon is the hardest part. Dereferencing means nothing to me, I'll look it up. But I can see how modifying *b actually modifies a. Cheers.
Julian Ilett Dereferencing just means "follow the pointer to the data it points to". If you know any assembler (as a hardware person you may well do!) it's like an indirect addressing mode, and if that means nothing then don't sweat it, most C programmers have no idea what these language features turn into when compiled.
Actually my example is slightly wrong, or the wording is. To declare a pointer to a variable of type , you write var* (i.e. the * follows the type), as I've written int* b. To dereference the pointer (access the data it points to), you write *, i.e. the * precedes the name, as in *b = 5;
Hope that makes sense, but I'm sure any C text will be far clearer than my explanation. BTW thanks for an interesting tutorial, I've done a bit with Arduino but nothing as sophisticated.
I just got my Nokia 5110 today.
Thanks for Post all of the code. I tried to fix it on my own, but I have a long way to go
Great video
The best tutorial I've ever seen ! Thank you ! ! !
Regarding DRY, I would suggest you have three functions: lcdWrite, lcdWriteCommand and lcdWriteData. The nicely-named functions simply call the underlying lcdWrite function with an appropriate flag set.
Violating DRY is asking always inviting trouble. Thanks for the very helpful video!
It's a lot more fun to see this and try to interface an Arduino with a 5110 myself than using one of those pre-made classes. This way, I feel like I learn a lot more about what I'm actually doing. Great tutorial videos, thanks Julian!
As a final tip, for sharing code, I suggest pastebin.com or any other code-snippet website. Those websites add syntax highlighting colours and make sure the indentation is preserved! :)
Cheers Bas - thanks for the tip, I'll take a look at pastebin
Nice code, Julian! I fought for hours with SparkFun's code. Your's is easy easy to understand and cleaner. Had my screen up and running in minutes! Next, going to see if I can pull in the LCD_Functions library to use the drawing tools there... unless you have code for that, too??!
Hi Julian, great job as always!
Your guess was correct, * means pointer in C and C++.
A C string is represented as a char pointer, which basically points to the memory address of the first character in your string and ends with the ASCII 0 character, which is the string null terminator character.
Hey, thanks for that. I've read that pointers are one of the least understood parts of the C language and I've yet to get my head around them.
For those of you getting "stray \357" etc etc etc errors, I think it's because the code was pasted with a different character encoding. I copy/pasted the same font from the Arduino website and then manually corrected the lines with the errors in the INO and it compiled.
The arficacts after reset may occur because you probably are not using logic level shifting. There are also different PCB versions of this Nokia modula - some can be powered with 5V, some not.
Hi julian, well explained, I'm gald your sharring this whole series, it's useful, saves people tons of time, it's practical. Bloody well done!
Great so far!! I can't find the font.h file you refer to.
Hi Julian, first of all thanks for your very informative videos which I enjoy immensely. Regarding this Nokia LCD, I like yourself, like a challenge and enjoy programming a lot, but surely there must be an Arduino library out here which would reduce the amount of hands on code bashing required to program it? Keep up the good work!
Fantastic, helped me a lot. Will make good use of your knowledge. thanks for teaching!
12:18 contrast - I am usign 5v and the screen contrast is dark, cannot get it light, is there a range to use ?
Nice work Julian, thank you. Like the fact that you showed the data sheet. I have a Nokia 3770 i wonder how that will go.
You could shorten the overall code by having LCDWriteCmd call LCDWriteData with a parameter for that defaults to high, but your Cmd function sets it to low?
Appologies if this has been mentioned before or doesn't really work. I'm still waiting for my hardware to arrive, but I'm reading up and watching vids. Yours are excellent! :-)
Nice work...but...it doesnt work for me. I get exit status 1
'ASCII' was not declared in this scope
...where do I get the font.h ?
HI Julian where did you get ASCII code you used on the NOKIA 5110 display
excellent thorough and well paced tutorial. thx.
Can I get some help on how to send a 'int' or 'float" variable to be displayed on the screen. I know it's not that complicated but I am having trouble imagining a way to do it.
Hi Julian
I understand you can put14 characters on each row, (14x6) which command do I use to position the character. example I what to put a letter "A" in the second line 5th position over.
I'm really bad at bitwise operation. What does the LcdXY() function do exactly?
Congrats Julian, it's amazing how clear you are during your explanation. I did really appreciate your video.
One question: In my experience when I try to light the upper left dots using the 0x55 and 0xaa commands, in my LCD, they are not displayed exactly at the upper left position of the display, but in almost end of the first line. Do u have a clue for that?
Thanks again,
Thanks David. Display not resetting properly? There are commands for setting the display address - you could try sending them.
David Gonzalez Your display is upside down.
Thank-you. I got my nokia 5110 working with my TI MSP430 Launchpad using energia. Same code, same pinout.
The only change I made was I didn't make the font.h file, I just pasted the ASCII array into my main code right under the define statements and removed the include "font.h"
Hey Julian. These are great vids! Programming the 5110 at a core level is something I haven't seen yet. I just take the easy path using the Adafruit 5110 library :) Cheers!
Thanks Eric. I couldn't find a video about programming this display from bit level upwards, so I thought I'd have a go myself. At some point, I fancy having a go at writing a library - maybe I'll write one for the 5110, or perhaps the 128x64 OLED.
Very cool! Look forward to more.
hello! can i display a long type variable instead of a char?
I have no random pixels ON. Is it possible you resetted it wrong? Reset needs to be done 30ms after VCC comes ON.
I have the font.h attached as you show. However, I'm getting this error. It's not seeing the ASCII from the font.h file.
Nokia_5110_tutorial.ino: In function 'void LcdWriteCharacter(char)':
Nokia_5110_tutorial:15: error: 'ASCII' was not declared in this scope
put this in your code: #include "font.h"
Hello Mister Ilett,
I copied your code and also included the font.h data but I still get error massages. For Example expected ',' or ';' before 'void'
void LcdWriteCharacter(char character)
^
I tried fixing this for a long time but I don't know how. Can you help me out?
Bloody beginner btw.
Thanks for the great videos and good explanations!
Cant you put the , o r ; there yourself? The code works fine.
excellent vids again, thank you
Hi,
the code works great, but I`ve got one problem:
"The End" stands on the display for around 0,1 sec, aber this the whole display is full with black pixels.
What`s the problem?
Thanks a million...
MilosMaric1982 Try changing contrast value in this line of code:
LcdWriteCmd(0xBF); // set LCD Vop (contrast)
0xB0 works for me, with 0xBF I can still see the letters, but the screen is almost black around them.
dou you know how, if i want to write upside down, so the lcd display can be rotate like smartphone
What are your thoughts on using the screen to display 2 large digits, and possibly a direction indicator? Would I need to write custom code to compose the entire screen image in an array and then send that serially?
Creating entire screen images isn't practical - you'd need 100 of them to encode all combinations of your 2 digits. You can cut that down to 10 by encoding each digit separately.
What board are you useing with the arduino nano?
Thank you Mr Ilett!
1st part was very easy to understand, but in the 2nd part I have a problem as many people here (I guess). Does not matter how I lower the screen contrast, it still remains lit fully but not dark as before. Even I can not to display "55" and "AA".
Could you please help me?
+Adam Insanoff Yes! Now it works. I figured out that I should decrease contrast much more. I put 0xA4 and it is just works!
+Adam Insanoff- Depending on the hardware, if you change the voltage from 5v to 3.3V, those values work as expected.
When I try the code I am getting this error "
fatal error: ASCII.h: No such file or directory
compilation terminated.
Error compiling."
great video.. made me understand a lot!.. but.. how do i print values to the lcd , not just "strings" but actual float or integer variables ?
Good point - that's an idea for a part #3. Not sure why I didn't think of that. I use 'dtostrf'.
Julian Ilett thanks man! .. i was stuck but you´ve pointed me in the right direction.. i 'll be here waiting for part #3
juan lobos Finally made a part3 - ruclips.net/video/cwsCxUhHbQM/видео.html
Thanks for giving me the idea.
any chance a new version for u8g2 will be available ?
So many clip explaning how to use 1 display. but how do you use 2?
amazing stuff :) Thank you very much :)
Aren't there librarys for this stuff?
how do you do the same thing with a TV as the display?
I keep on getting this error message:
Arduino: 1.8.1 Hourly Build 2016/12/24 01:12 (Mac OS X), Board: "Arduino/Genuino Uno"
In file included from /Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino:7:0:
font.h:101: error: stray '\357' in program
};
^
font.h:101: error: stray '\273' in program
font.h:101: error: stray '\277' in program
/Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino: In function 'void setup()':
/Users/AdaJohnson/Documents/Arduino/sketch_mar27b/sketch_mar27b.ino:48:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
LcdWriteStng("Hi, My Name Is Theo");
^
exit status 1
stray '\357' in program
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I fixed it
I'm getting same error, how did you fix it? This is my first manual library
@@arthurjohnson2165 That was kinda rude of you m8
first of all thanks to you and i need a help where i'm finding "font.h" librery
Thank you. I missed the "show more" link before.
Firstly, thanks for all the superb videos, and your infectious enthusiasm. It infected me greatly. I know you're a busy chap, but I wondered if you could help me with a particularly tenacious compiling error. I followed (many times) parts 1 and 2 of your 5110 tutorials, and copied and pasted your code from this forum, but continue to get this straightforward error:
Nokia5110_2_5:10: error: expected ',' or ';' before 'void'
from this code:
#include "font.h";
void LcdWriteString(char *characters)
{
while(*characters) LcdWriteCharacter(*characters++);
}
It all looked fine to me, but I tried inserting and removing semicolons anyway, without joy.
Could it be something to do with different versions of Arduino software or Nano version? My Nano is V3.0, and I'm using Arduino 1.0.5. I even checked for non printing characters in the text, but that looked clean.
I searched for the error and followed the pointers, but it all looks as it should to my relatively untrained eye. I have rtfm, so to speak.
I'd be very grateful for any advice you may be able to give me.
Regards,
Mike Adams
Michael,
I had the same issue and found the solution to be inside the font header file itself. If you tried to copy the font.h file from this page, try deleting the final semi-colon in the file, which is at the bottom of the file directly following the curly bracket. Press enter to obtain a new line and then type a semi-colon and it should then compile without error.
Thanks very much. I'll give it a go. That was kind of you.
@@1holy1holy1 Thanks a lot for this tip, now it works
I have bee following along from the first video and was able to get all the pixels to lite, but now on the second video I inserted the (0x0C) to put the display back to normal and no matter what I do the display stays with all pixels lit
+alphahr You must set the contrast with a potentiometer (i think)
I would suggest instead of having comments for every command write that you define the commands and modifier bits and use them like CMD_DISPMODE | DISPMODE_NORMAL ... that way the meaning is in the code. :) Pointers are one of the most useful features in C especially when fiddling with memory mapped stuff. You can use a pointer like an array.. you can have pointers to pointers.. fun stuff :)
How do I get the language to be a .h file and once I do that where do I put it
I found that I need to add 10K resistors on my data lines to get the display to work
Where can I find font.h file?
Thank you.
I was about to ask for the font.h file but I found a copy elsewhere. If anyone else needed the font.h file look here playground.arduino.cc/Code/PCD8544
Dear Julian, THX!!
"star variables" are just pointers
Thank you!
for me is not working..and i changed 9 with c
error in line 9, 16, 17, 30 and 62.
Can anyone send me the link to the code
Tengo q descargar algunas librerias?
Hi, I can't find the font.h file
Hi. Sort coment by time, and you can find this file in second coment.
Very inspiring! ^_^
Of course 6x84 is divisible by 3, every multiple of 6 is divisible by 3 and by 2 as 6 = 3*2 :-)
Thanks again.
Cute ending
I found this very helpful, Julian. If you want a simple intro to pointers, see my article:
www.drdobbs.com/cpp/computer-programming-and-precise-termino/208808373
After reading that, a valid pointer has an rvalue that is a memory address (or null). The indirection operator (*) simply says: "Go to the memory address and fetch what's there." The address of operator (&) simply says: "Fetch the address of where this variable is stored in memory." So, in the following code fragment:
int val = 10;
int *iptr;
char name[] = "Jack";
char *cptr;
iptr = &val;
cptr = name;
Suppose val exists in memory at address 1000 and name is at 2000. The statement iptr = &val make the rvalue of iptr equal to 1000. The statement printf(*iptr); would say: "Get the rvalue of iptr (i.e., 1000), go to that address and fetch "int" bytes (2 bytes) of data, and then print those two bytes (10)".
In C, an array name is the same as the array's lvalue, so cptr = name is syntactically the same as cptr = &name[0]. In a totally biased plug, take a look at Beginning C for Arduino on Amazon.com. You can click on the cover and "look inside" to see the Table of Contents...there are two chapters on pointers.
Disregard please I found the problem.