Wish Nokia 5110 LCD library

MbedAndroid

Well-Known Member
Licensed User
Longtime User
here you are
some code i found on internet converted to B4R
feel free to add/mod this start for this cheap 5110
 

Attachments

  • Nokia5110.bas
    9.3 KB · Views: 381

MbedAndroid

Well-Known Member
Licensed User
Longtime User
here a update
1- moved the const to progmem (thanks to Erel) This saves you aprx 460b of RAM
2-Putstring now returns the actual x pointer, so you use this as start for next write (for example multiple writings instead of using Jointstring)
 

Attachments

  • Nokia5110.bas
    9.3 KB · Views: 368

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
i tried the code but i got this error:

B4R version: 1.20
Parsing code. (0.01s)
Compiling code. (0.01s)
Building project (0.01s)
Compiling & deploying Ino project (Arduino/Genuino Mega or Mega 2560 - COM3) Error
Could not find file 'D:\Programs\B4R\NOKIA_TEST\Objects\src\src'.
 

Mostez

Well-Known Member
Licensed User
Longtime User
I think I deleted the post by mistake instead of edit it, however, it works now i forgot to edit AppStart sub :)
May I ask, how to set space between characters?

Thanks

well i think I got it
B4X:
Sub PutString(x As Byte, y As Byte,  pcbuff() As Byte) As Byte

    Dim n=pcbuff.length As Byte
    Dim r=0 As Byte
    Do While(n>r)
    PutChar(x, y, (pcbuff(r)))
    r = r + 1
    x = x + 6 'adjust space between chars, now we have space ;)
    Loop
    Return x
End Sub
 
Last edited:

MbedAndroid

Well-Known Member
Licensed User
Longtime User
yes, but dont forget the amount of chars in a row is very limited. each space occupies 1/84 of a row
 

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
kindly allow me to share this modified version.

1) New backlight control pin (added), connect LCD backlight pin to Arduino pin (7), backlight is controlled by PWM
2) you can call InitN5110 with two parameters to init LCD and adjust contrast and backlight
3) One dot space between characters
4) Clear removed from InitN5110 sub
5) Pin initialization moved to AppStart sub

Thanks
 

Attachments

  • B4R_nokia_5110.txt
    6.7 KB · Views: 392

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
Now you can load images to Nokia 5110 LCD, just generate image bitmap array by LCD assistance then copy the resulting array elements to your Arduino code, to modify B4RImage Array elements(requires adding line-continuation characters, space and underscore) then call LoadImageArray sub, that's it :)
This example loads 'B4R' image to LCD

Note: byte counting index should be 0 to 503, not 504 (modified)

Regards
 

Attachments

  • NOKIA_5110.zip
    3.1 KB · Views: 386
Last edited:
Top