Bitmap to a nokia 5110 LCD
Crosswinds
Posts: 182
Hello Guys!
I have my 5110 up and running with the object from obex!
But now ofcourse i also want to try out to show a bitmap. I have created a bitmap that is 84x48, converted it with LCD assistant, and get this output:
i guess i need to replace the 0x with a $, but i have no idea how to modify the object, or create the function for this.
Is there anyone that maybe can help me in the right direction?
I have my 5110 up and running with the object from obex!
But now ofcourse i also want to try out to show a bitmap. I have created a bitmap that is 84x48, converted it with LCD assistant, and get this output:
//
// File generated by LCD Assistant
// http://en.radzio.dxp.pl/bitmap_converter/
//
const unsigned char igen [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x40, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x1C, 0x60, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08,
0x04, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x0C, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x40, 0x20, 0x20, 0x10, 0x08, 0x08, 0x04, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
i guess i need to replace the 0x with a $, but i have no idea how to modify the object, or create the function for this.
Is there anyone that maybe can help me in the right direction?
Comments
My favorite tool for this kind of stuff is EditPlus
That was a fast conversion you did!
Iam a bit unsure of how to send this to the LCD also. Any tip for that?
and also Do i need to break it down to 5 sections like the fonts are?
For that you are on your own. I kind of assumed that taking the time to make a bitmap meant you knew how to get it into the display. I don't have one of those so I have no experience with it.
Oh okey. Yes well, i needed to create a bitmap to try this out. hehe. Editing single chars the font i do understand. But how to send that whole chunk to the lcd is another story.
It would have been much cleaner to do it how you did, but I couldn't find any examples that showed that syntax!
[code]
PUB LcdInitialize
'AT RESET THE LCD HAS THE FOLLOWING:
'Power-down mode (bit PD = 1) **DEFAULT AFTER RESET**
'Horizontal addressing (bit V = 0) **DEFAULT AFTER RESET**
'Normal instruction set (bit H = 0) **DEFAULT AFTER RESET**
'Display blank (bit D = 0, bit E = 0) **DEFAULT AFTER RESET**
'X6 to X0 = 0 | 0 | 0 | 0 | 0 | 0 | 0 - (Line0) **DEFAULT AFTER RESET**
'Y2 to Y0 = 0 | 0 | 0 - (Bank0) **DEFAULT AFTER RESET**
'Temperature control mode (TC1 TC0 =0) **DEFAULT AFTER RESET**
'BS2 to BS0 = 0 | 0 | 0 - 1:100 **DEFAULT AFTER RESET**
'reset lcd
outa[LcdCs] := 0 'turn the lcd chip on
outa[LcdRst] := 0 'turn the reset on
BS2.SHIFTOUT(LcdRst, LcdClk, 0, BS2#MSBFIRST, 2) ' clock the reset in ****REQUIRED****
outa[LcdRst] := 1 'turn the reset off
outa[LcdDc] := 0 'sets Lcd command mode
'CHANGES INSTRUCTION SET
'Extended instruction set (bit H = 1)
'Power-on mode (bit PD = 0)
'Horizontal addressing (bit V = 0)
BS2.SHIFTOUT(LcdSda, LcdClk, 33, BS2#MSBFIRST, 8) '33 0010 0001
'
{The settings below are voltage related. They should not be changed unless you know
what your doing. If you are using 3.3v, then the default settings are correct for you.}
'
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 0.8 V -- 8)
'BS2.SHIFTOUT(LcdSda, LcdClk, 136, BS2#MSBFIRST, 8) '136 1000|1000
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 1.6 V -- 16)
'BS2.SHIFTOUT(LcdSda, LcdClk, 144, BS2#MSBFIRST, 8) '144 1001|0000 ***BEST? FOR 5v OPERATION***
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 1.8 V -- 18)
'BS2.SHIFTOUT(LcdSda, LcdClk, 146, BS2#MSBFIRST, 8) '146 1001|0010
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 2.2 V -- 22)
'BS2.SHIFTOUT(LcdSda, LcdClk, 150, BS2#MSBFIRST, 8) '150 1001|0110
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 2.4 V -- 24)
BS2.SHIFTOUT(LcdSda, LcdClk, 152, BS2#MSBFIRST, 8) '152 1001|100 ***BEST FOR 3.3v OPERATION***
'Needs Extended instruction set (bit H = 1)
'Command set VOP; (set operation voltage to 2.8 V -- 28)
'BS2.SHIFTOUT(LcdSda, LcdClk, 156, BS2#MSBFIRST, 8) '156 1001|1100
{Needs Extended instruction set (bit H = 1)
Command set VOP; (set operation voltage to 3.3 V -- 33) }
'BS2.SHIFTOUT(LcdSda, LcdClk, 161, BS2#MSBFIRST, 8) '161 1010|0001
{Needs Extended instruction set (bit H = 1)
Command set VOP; (set operation voltage to 7 V -- 70)}
'BS2.SHIFTOUT(LcdSda, LcdClk, 198, BS2#MSBFIRST, 8) '198 1100|0110
'
{Needs Extended instruction set (bit H = 1)
Sets Bias - 1:48 **Optimum**}
BS2.SHIFTOUT(LcdSda, LcdClk, 19, BS2#MSBFIRST, 8) '19 0001|0011
'
{CHANGES INSTRUCTION SET
Normal instruction set (bit H = 0)
Power-on mode (bit PD = 0)
Horizontal addressing (bit V = 0)}
BS2.SHIFTOUT(LcdSda, LcdClk, 32, BS2#MSBFIRST, 8) ' 32 0010|0000
outa[LcdDc] := 1 'sets Lcd data mode
ZeroLcdRam 'puts cursor at 0, and clears lcd ram.
{
******************PCD8544******DATA*****************************************
For all commands below, D/C mode = 0 (command mode) (command/data mode pin needs to be low)
D/C 7 6 5 4 3 2 1 0
_____|____|______|______|______|______|______|______|__________________________________________
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 - no operation
0 | 0 | 0 | 1 | 0 | 0 | PD | V | H = PD-power down control; V-address entry mode; H-normal/extended instruction set control
| | | | | | | |
1 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 - writes data to display RAM
The write data’and function set’commands can be executed in both cases of H. (H = 0 or 1)
'Power-on mode (bit PD = 0)
'Power-down mode (bit PD = 1) **DEFAULT AFTER RESET**
• All LCD outputs at VSS (display off)
• Bias generator and VLCD generator off, VLCD can be disconnected
• Oscillator off (external clock possible)
• Serial bus, command, etc. function
• Before entering Power-down mode, the RAM needs to be filled with‘0’s,
to ensure the specified current consumption.
'Horizontal addressing (bit V = 0) **DEFAULT AFTER RESET**
'Vertical addressing (bit V = 1)
'Normal instruction set (bit H = 0) **DEFAULT AFTER RESET**
'Extended instruction set (bit H = 1)
(H = 0) Normal instruction set. When H = 0 the commands‘display control’,‘set Y address and‘set X address can be performed
Display control (bit D, bit E)
• 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 - Display blank (bit D = 0, bit E = 0) **DEFAULT AFTER RESET** 8
• 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 - Normal Display (bit D = 1, bit E = 0) 12
• 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 - All display segments on (bit D = 0, bit E = 1) 9
• 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 - Inverse video mode (bit D = 1, bit E = 1) 13
'Address counter X6 to X0
• X6 to X0 = 0 | 0 | 0 | 0 | 0 | 0 | 0 - (Line0) **DEFAULT AFTER RESET**
• X6 to X0 = 1 | 0 | 1 | 0 | 0 | 1 | 1 - (Line83, last line)
'Address counter Y2 to Y0
• Y2 to Y0 = 0 | 0 | 0 - (Bank0) **DEFAULT AFTER RESET**
• Y2 to Y0 = 1 | 0 | 1 - (Bank5, last bank)
7 6 5 4 3 2 1 0
|____|______|______|______|______|______|______|______-___________________________________
| 0 | 0 | 0 | 0 | 0 | 1 | X | X - do not use
| 0 | 0 | 0 | 0 | 1 | D | 0 | E - sets display configuration
| 0 | 0 | 0 | 1 | X | X | X | X - do not use
| 0 | 1 | 0 | 0 | 0 | Y2 | Y1 | Y0 - sets Y-address of RAM 0 <=≤ Y =>≤ 5
| 1 | X6 | X5 | X4 | X3 | X2 | X1 | X0 - sets X-address part of RAM 0 <=≤ X =>≤ 83
(H = 1) The extended instruction set can be executed.
7 6 5 4 3 2 1 0
|____|______|______|______|______|______|______|______-___________________________________
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 - do not use
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | X - do not use
| 0 | 0 | 0 | 0 | 0 | 1 | TC1 | TC0 - set Temperature Coeffcient (TCx)
| 0 | 0 | 0 | 0 | 1 | X | X | X - do not use
| 0 | 0 | 0 | 1 | 0 | BS2 | BS1 | BS0 - set Bias System (BSx)
| 0 | 1 | X | X | X | X | X | X - do not use
| 1 | VOP6 | VOP5 | VOP4 | VOP3 | VOP2 | VOP1 | VOP0 - write VOP to register
'Temperature control mode (TC1 TC0 =0) **DEFAULT AFTER RESET**
• The temperature coefficient of VLCD is selected by bits TC1 and TC0.
'Bias system (BS2 to BS0 =0)
BS2 to BS0 = 0 | 0 | 0 - 1:100 **DEFAULT AFTER RESET**
BS2 to BS0 = 0 | 0 | 1 - 1:80
BS2 to BS0 = 0 | 1 | 0 - 1:65 / 1:65
BS2 to BS0 = 0 | 1 | 1 - 1:48 **Optimum**
BS2 to BS0 = 1 | 0 | 0 - 1:40 / 1:34
BS2 to BS0 = 1 | 0 | 1 - 1:24
BS2 to BS0 = 1 | 1 | 0 - 1:18 / 1:16
BS2 to BS0 = 1 | 1 | 1 - 1:10 / 1:9 / 1:8
'VOP is set to a +16
See next post for latest code.
Moved to ObEx
-- http://obex.parallax.com/objects/836/
Can you please help me?
Where can I find one that works (spin) or PBAs for the display: Nokia 5110?
Since the connections should be described.
Thank you.
greeting
If you can't find it then I will do that later from my PC. (On iPhone now)