Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

LCD Help needed, 16x2s are boring

  • Please log in to reply
100 replies to this topic

#101 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 20 August 2011 - 01:50 PM

Hi guys,

I've played a little with the code and found that we can't use text functions together with graphics - the text goes directly to the LCD than the graphic gets into the buffer first and than whole buffer transferred to display.
So I added functions DrawString and DrawChar that draw string into buffer first, so it can be combined with graphics and shown by calling Lcd.Refresh() function:

public void DrawString(int x, int line, string str, bool mode)
            foreach (char c in str)
                DrawCharacter(x, line, c,mode);

                x += 5; // 6 pixels wide

                if (x + 5 >= 84)
                    x = 0;    // ran out of this line

                if (line >= 48 / 8)
                    return;        // ran out of space :(

        protected void DrawCharacter(int x, int line, char c, bool mode)
            for (int i = 0; i < 5; i++)
                if (mode)
                    ByteMap[x + (line * 84)+ i] |= NokiaCharacters.ASCII[c - 0x20][i];
                    ByteMap[x + (line * 84) + i] |=(byte) ~NokiaCharacters.ASCII[c - 0x20][i];


Nice Eugene! You're welcome to re-post the code with that added in.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.