Netduino home hardware projects downloads community

Jump to content


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

LCD Help needed, 16x2s are boring


  • Please log in to reply
100 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 19 December 2010 - 04:00 PM

Hello, I am trying to get a nice output for my netduino. The best I could come up with is an LCD, because then I can show anything on it. Except that the 16x2 LCDs are kinda boring, so I was wondering if this (http://www.sparkfun.com/products/10168) would work with a netduino, and if I would need other stuff like shift registers to make it work. This is late Christmas shopping (for myself) so a quick response is highly appreciated :). Thank you!

#2 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 19 December 2010 - 05:20 PM

Hi Omar, I have one of those LCD displays and I have been trying to get it to work for the past few nights. I think it will work eventually and I don't think I need any external components. I'll be happy to post my work in this thread and work on it together with you. -AlfredBr

#3 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 19 December 2010 - 05:21 PM

I'm adapting the Arduino example from the Sparkfun link. I'll post that later today.

#4 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 19 December 2010 - 05:43 PM

Hi Omar,

I have one of those LCD displays and I have been trying to get it to work for the past few nights. I think it will work eventually and I don't think I need any external components.

I'll be happy to post my work in this thread and work on it together with you.

-AlfredBr


I have high hopes, I'll order it now. I'll also order some shift registers just in case, they are good to have laying around anyways. I'll hopefully be working on it over the winter break. I'd love to work on it with you.

Thanks for the quick response!

#5 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 21 December 2010 - 12:05 PM

Omar,

This is the code I have so far, but it does not work (yet). It is adapted from the Arduino example from the Sparkfun link.
This code uses SPI on ports 11-13, and ports 0,1,4,5 for SCE, LED Backlight, Reset and D/C (data/command).
BTW, I am using no external components other than a 10uF capacitor (and some wire).

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace NokiaLCDwSPI
{
    public struct MyPins
    {
        public const Cpu.Pin ChipSelectPin = Pins.GPIO_PIN_D0;
        public const Cpu.Pin BacklightPin = Pins.GPIO_PIN_D1;
        public const Cpu.Pin ResetPin = Pins.GPIO_PIN_D4;
        public const Cpu.Pin DataCommandPin = Pins.GPIO_PIN_D5;
    }

    public class Program
    {
        #region ASCII Chars

        private static byte[] ASCII = new byte[]
                                           {
                                               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 →
                                           };

        #endregion

        private const int LcdX = 84;
        private const int LcdY = 48;

        private const bool Command = false;
        private const bool Data = true;
        private const bool Off = false;
        private const bool On = true;

        delegate void Procedure();
        delegate void Action(string msg);
        delegate void Toggle(bool mode);

        public static void Main()
        {
            var spiConfiguration = new SPI.Configuration(
                MyPins.ChipSelectPin,  // chip select port
                false,                 // IC is accessed when chip select is low
                1,                     // setup time 1 ms
                1,                     // hold chip select 1 ms after transfer
                false,                 // clock line is low if device is not selected
                true,                  // data is sampled at leading edge of clock
                2000,                  // clockrate is 2 MHz
                SPI.SPI_module.SPI1    // use first SPI bus
                );

            using (var spi = new SPI(spiConfiguration))
            using (var backlightPort = new OutputPort(MyPins.BacklightPin, true))
            using (var resetPort = new OutputPort(MyPins.ResetPin, true))
            using (var dataCommand = new OutputPort(MyPins.DataCommandPin, true))
            {
                Procedure chipReset = delegate
                {
                    resetPort.Write(false);
                    Thread.Sleep(100);
                    resetPort.Write(true);
                };

                Toggle chipMode = dataCommand.Write;
                Toggle backlight = backlightPort.Write;
                Toggle inverseVideo = delegate(bool mode)
                                          {
                                              try
                                              {
                                                  chipMode(Command);
                                                  spi.Write(mode ? new byte[] {0x0D} : new byte[] {0x0C});
                                              }
                                              finally
                                              {
                                                  chipMode(Data);
                                              }
                                          };

                Procedure chipInitialize = delegate
                {
                    try
                    {
                        chipMode(Command);
                        spi.Write(new byte[] {0x20, 0x0C});
                    }
                    finally 
                    {
                        chipMode(Data);
                    }
                };

                Procedure clearScreen = delegate
                                         {
                                             chipMode(Data);
                                             for (var i = 0; i < LcdX * LcdY / 8; i++)
                                             {
                                                 spi.Write(new byte[]{0x00});
                                             }
                                         };

                Action writeText = delegate(string message)
                                       {
                                           chipMode(Data);
                                           foreach (var c in message.ToCharArray())
                                           {
                                               var glyph = new byte[5];
                                               for (var i = 0; i < 5; i++)
                                               {
                                                   var pos = ((c - 0x20)*5) + i;
                                                   glyph[i] = ASCII[pos];
                                               }
                                               spi.Write(glyph);
                                           }
                                       };

                // start here

                backlight(On);
                chipReset();
                chipInitialize();
                clearScreen();
                //inverseVideo(On);
                writeText("Hello World");
                Thread.Sleep(1000);
                backlight(Off);
            }
        }
    }
}


#6 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 21 December 2010 - 09:36 PM

Thanks for the code! I haven't gotten the screen but I am re writing all of your code into a class instead of the program's main. Very nice and interesting code you got there, I've never seen things like "Toggle" and some other stuff. A few questions: Why do you use 'var' and not 'char' ? And why do you have try statements?

#7 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 21 December 2010 - 10:29 PM

Thanks for the code! I haven't gotten the screen but I am re writing all of your code into a class instead of the program's main. Very nice and interesting code you got there, I've never seen things like "Toggle" and some other stuff.

A few questions:
Why do you use 'var' and not 'char' ? And why do you have try statements?


Ha! I originally had it all in a proper class and moved it into a standalone program for this post!

var is a generic type...the compiler will figure out if it should be a char, int, OutputPort, or what-have-you at compile time based on the type found on the right hand side of the equal sign.

I use the try/finally to make sure that the 'chipMode(Data)' statement is always executed. It is not truly necessary in this small example.

The types Toggle, Procedure, Action are all 'delegates' I use to make the code easier (for me) to organize and read.

#8 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 21 December 2010 - 11:14 PM

Ha! I originally had it all in a proper class and moved it into a standalone program for this post!

var is a generic type...the compiler will figure out if it should be a char, int, OutputPort, or what-have-you at compile time based on the type found on the right hand side of the equal sign.

I use the try/finally to make sure that the 'chipMode(Data)' statement is always executed. It is not truly necessary in this small example.

The types Toggle, Procedure, Action are all 'delegates' I use to make the code easier (for me) to organize and read.


I see. Well when I learn a bit more about those I'll have to start using them, they look great. As of now I must change it into a class and set it up for it to fit my style a bit more.

I am also working on a method that will take a Bitmap and display it... but first I need to have my lcd here ! Thanks again for that wonderful code, and I'll post my changes soon.

#9 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 December 2010 - 12:05 AM

Here it is! Please note that I changed the pins, make sure that you got the right ones hooked up if you are going to try this code.
Let me know if it works and if I messed anything up.

 public class Nokia_5110
    {
        private const int WIDTH = 84, HEIGHT = 48, EIGTH_AREA = 504; // EIGTH_AREA = (WIDTH * HEIGHT) / 8

        private OutputPort _backlightPort, _resetPort, _daComPin;
        private SPI _dataPort;
        private bool _invd;

        public Nokia_5110(Cpu.Pin chipSelect = Pins.GPIO_PIN_D0, Cpu.Pin backlight= Pins.GPIO_PIN_D1, 
            Cpu.Pin reset = Pins.GPIO_PIN_D2, Cpu.Pin dataCommand = Pins.GPIO_PIN_D3)
        {
            SPI.Configuration spiConfiguration = new SPI.Configuration(
                chipSelect,  // chip select port
                false,                 // IC is accessed when chip select is low
                1,                     // setup time 1 ms
                1,                     // hold chip select 1 ms after transfer
                false,                 // clock line is low if device is not selected
                true,                  // data is sampled at leading edge of clock
                2000,                  // clockrate is 15 MHz
                SPI.SPI_module.SPI1    // use first SPI bus
                );

            _dataPort = new SPI(spiConfiguration);
            _backlightPort = new OutputPort(backlight, false);
            _resetPort = new OutputPort(reset, false);
            _daComPin = new OutputPort(dataCommand, false);
           
            Reset();
            Initialize();
            Clear();
        }

        public void Initialize()
        {
            DataMode = false;
            _dataPort.Write(new byte[] { 0x20, 0x0C });
            DataMode = true;
        }

        public void DrawImage(Bitmap img)
        {

        }

        public void WriteText(string text)
        {
            DataMode = true;
            foreach (var c in text.ToCharArray())
            {
                byte[] glyph = new byte[5];

                for (int i = 0; i < 5; i++)
                    glyph[i] = NokiaCharacters.ASCII[((c - 0x20) * 5) + i];

                _dataPort.Write(glyph);
            }
        }

        public void Clear()
        {
            DataMode = true;
            for (var i = 0; i < EIGTH_AREA; i++)
                _dataPort.Write(new byte[] { 0x00 });
        }

        private void Inverse(bool inverse)
        {
            DataMode = false;
            _dataPort.Write(inverse ? new byte[] { 0x0D } : new byte[] { 0x0C });
            DataMode = true;
            _invd = inverse;
        }

        public void Reset()
        {
            _resetPort.Write(false);
            Thread.Sleep(100);
            _resetPort.Write(true);
        }

        public bool Backlight
        {
            get { return _backlightPort.Read(); }
            set { _backlightPort.Write(value); }
        }

        public bool InverseColors
        {
            get { return _invd; }
            set { Inverse(value); }
        }

        private bool DataMode
        {
            get { return _daComPin.Read(); }
            set { _daComPin.Write(value); }
        }
    }

Notes: "NokiaCharacters.ASCII" is a public static class that contains the "public static byte[] ASCII = new byte[] {....};" thing.

#10 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 22 December 2010 - 01:59 PM

Well, so far I have not gotten anything but the backlight to work. (Note: throw a resistor in series or use PWM 'cause the backlight is BRIGHT at 3.3V.) I have a Saleae logic analyzer and I have been watching the signals (SPI,D/C,Reset) and the sequencing looks correct. I've compared the sequences to the examples in the datasheet and I think I am doing everything correctly, but still no pixels changing on the LCD. I've tried clearing the screen with something other than 0x00 to see if I can get a pattern on the LCD, but no luck. I'll continue experimenting, but I am very interested in your experience when you get your screen.

#11 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 December 2010 - 03:19 PM

Well, so far I have not gotten anything but the backlight to work. (Note: throw a resistor in series or use PWM 'cause the backlight is BRIGHT at 3.3V.)

I have a Saleae logic analyzer and I have been watching the signals (SPI,D/C,Reset) and the sequencing looks correct. I've compared the sequences to the examples in the datasheet and I think I am doing everything correctly, but still no pixels changing on the LCD. I've tried clearing the screen with something other than 0x00 to see if I can get a pattern on the LCD, but no luck.

I'll continue experimenting, but I am very interested in your experience when you get your screen.


Alright, the lcd is coming in thursday. I'll test it then and let you know what it does.

#12 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 23 December 2010 - 10:48 PM

Well, so far I have not gotten anything but the backlight to work. (Note: throw a resistor in series or use PWM 'cause the backlight is BRIGHT at 3.3V.)

I have a Saleae logic analyzer and I have been watching the signals (SPI,D/C,Reset) and the sequencing looks correct. I've compared the sequences to the examples in the datasheet and I think I am doing everything correctly, but still no pixels changing on the LCD. I've tried clearing the screen with something other than 0x00 to see if I can get a pattern on the LCD, but no luck.

I'll continue experimenting, but I am very interested in your experience when you get your screen.



I got the same problem. I hooked it all up and the screen displays nothing, but the back light does work. have you gotten it to work yet?

Chris W if you are reading this, do you know what could be wrong?

#13 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 24 December 2010 - 01:03 AM

Okay...i am going to do a careful read of the datasheet tonight and really step through this. We must be missing something fundamental.

#14 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 24 December 2010 - 01:18 AM

Okay...i am going to do a careful read of the datasheet tonight and really step through this. We must be missing something fundamental.


Alright, I'll do the same, but I probably wont understand most of it :unsure: . I'll try.

I'll let you know if I get it working.

EDIT:
I couldn't do anything at all :( , I read over the clock frequency stuff, checked the code to make sure it was executing and even checked my connections for the trillionth time.
Here is my setup right now:

public Nokia_5110(Cpu.Pin chipSelect = Pins.GPIO_PIN_D10, Cpu.Pin backlight= Pins.GPIO_PIN_D9,
            Cpu.Pin reset = Pins.GPIO_PIN_D7, Cpu.Pin dataCommand = Pins.GPIO_PIN_D8)
        {
            SPI.Configuration spiConfiguration = new SPI.Configuration(
                chipSelect,            // chip select port
                false,                 // IC is accessed when chip select is low
                1,                     // setup time 1 ms
                1,                     // hold chip select 1 ms after transfer
                false,                 // clock line is low if device is not selected
                true,                  // data is sampled at leading edge of clock
                2000,                 // clockrate is 15 MHz
                SPI.SPI_module.SPI1   // use first SPI bus
                );

            _dataPort = new SPI(spiConfiguration);
            _backlightPort = new PWM(backlight);
            _resetPort = new OutputPort(reset, true);
            _daComPin = new OutputPort(dataCommand, true);

            Initialize();
            Reset();
            Clear();
        }

LCD|Netduino
1|3V3
2|GND
3|ChipSelect (Pin 10)
4|Reset(Pin 7)
5|Data/Command (Pin 8)
6|Pin 11
7|Pin 13
8|Backlight (Pin 9 PWM)

Does that look right?

#15 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 24 December 2010 - 10:06 AM

Yes, it looks right. (I'm just clarifying our pins for those watching at home...) LCD|Netduino 1|Vcc 3V3 2|GND 3|ChipSelect (Pin 10) 4|Reset(Pin 7) 5|Data/Command (Pin 8) 6|MOSI (Pin 11) - input 7|SCLK (Pin 13) - clock 8|Backlight (Pin 9 PWM) If we can't get anything working over the holidays, I'll call SparkFun...they have people there than sometimes give useful hints...

#16 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 24 December 2010 - 03:16 PM

Yes, it looks right. (I'm just clarifying our pins for those watching at home...)

LCD|Netduino
1|Vcc 3V3
2|GND
3|ChipSelect (Pin 10)
4|Reset(Pin 7)
5|Data/Command (Pin 8)
6|MOSI (Pin 11) - input
7|SCLK (Pin 13) - clock
8|Backlight (Pin 9 PWM)

If we can't get anything working over the holidays, I'll call SparkFun...they have people there than sometimes give useful hints...

Thanks for checking that! I'll work on it aswell, I love the free time I get during the winter break :). I'll keep you updated.

#17 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 26 December 2010 - 03:17 AM

I've tried it all :wacko: ... I emailed sparkfun and made this:

Attached File  Nokia_5100.png   86.68KB   145 downloads Note the picture of the screen belongs to spark fun, it is from their website.

I made the array of character more efficient, no need to do the math anymore!

public static readonly byte[][] ASCII = new byte[][]
                                           {
                                                new byte[]{0x00, 0x00, 0x00, 0x00, 0x00}    // 20  
                                               , new byte[]{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
                                               , new byte[]{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
                                               , new byte[]{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
                                               , new byte[]{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
                                               , new byte[]{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
                                               , new byte[]{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
                                               , new byte[]{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
                                               , new byte[]{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
                                               , new byte[]{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
                                               , new byte[]{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
                                               , new byte[]{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
                                               , new byte[]{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
                                               , new byte[]{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
                                               , new byte[]{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
                                               , new byte[]{0x20, 0x10, 0x08, 0x04, 0x02} // 2f /
                                               , new byte[]{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
                                               , new byte[]{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
                                               , new byte[]{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
                                               , new byte[]{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
                                               , new byte[]{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
                                               , new byte[]{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
                                               , new byte[]{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
                                               , new byte[]{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
                                               , new byte[]{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
                                               , new byte[]{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
                                               , new byte[]{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
                                               , new byte[]{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
                                               , new byte[]{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
                                               , new byte[]{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
                                               , new byte[]{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
                                               , new byte[]{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
                                               , new byte[]{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
                                               , new byte[]{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
                                               , new byte[]{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
                                               , new byte[]{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
                                               , new byte[]{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
                                               , new byte[]{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
                                               , new byte[]{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
                                               , new byte[]{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
                                               , new byte[]{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
                                               , new byte[]{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
                                               , new byte[]{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
                                               , new byte[]{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
                                               , new byte[]{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
                                               , new byte[]{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
                                               , new byte[]{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
                                               , new byte[]{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
                                               , new byte[]{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
                                               , new byte[]{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
                                               , new byte[]{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
                                               , new byte[]{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
                                               , new byte[]{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
                                               , new byte[]{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
                                               , new byte[]{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
                                               , new byte[]{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
                                               , new byte[]{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
                                               , new byte[]{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
                                               , new byte[]{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
                                               , new byte[]{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
                                               , new byte[]{0x02, 0x04, 0x08, 0x10, 0x20} // 5c ¥
                                               , new byte[]{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
                                               , new byte[]{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
                                               , new byte[]{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
                                               , new byte[]{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
                                               , new byte[]{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
                                               , new byte[]{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
                                               , new byte[]{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
                                               , new byte[]{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
                                               , new byte[]{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
                                               , new byte[]{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
                                               , new byte[]{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
                                               , new byte[]{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
                                               , new byte[]{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
                                               , new byte[]{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j 
                                               , new byte[]{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
                                               , new byte[]{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
                                               , new byte[]{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
                                               , new byte[]{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
                                               , new byte[]{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
                                               , new byte[]{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
                                               , new byte[]{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
                                               , new byte[]{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
                                               , new byte[]{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
                                               , new byte[]{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
                                               , new byte[]{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
                                               , new byte[]{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
                                               , new byte[]{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
                                               , new byte[]{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
                                               , new byte[]{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
                                               , new byte[]{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
                                               , new byte[]{0x00, 0x08, 0x36, 0x41, 0x00} // 7b 
                                               , new byte[]{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
                                               , new byte[]{0x00, 0x41, 0x36, 0x08, 0x00} // 7d 
                                               , new byte[]{0x10, 0x08, 0x08, 0x10, 0x08} // 7e ←
                                               , new byte[]{0x78, 0x46, 0x41, 0x46, 0x78} // 7f →
                                           };

public void WriteText(string text)
        {
            DataMode = true;

            foreach (var c in text.ToCharArray())
                _dataPort.Write(NokiaCharacters.ASCII[(c - 0x20)]);
        }


#18 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 28 December 2010 - 06:19 AM

sooo any luck yet? I haven't been able to get it to work.

#19 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 31 December 2010 - 04:19 AM

I think I'm about ready to give up on this little LCD display. http://www.sparkfun.com/products/10168 I've tried everything I know and NOTHING works. Sometimes, when working on a project, I get little partial successes that let me know if I am on the right or wrong track, but this device doesn't give anything up. I don't have the slightest clue what to try next. The analyzer shows that my signals match the datasheet, but nothing appears on the display. So, I'm shopping for another LCD graphic display. If anyone wants this one, I'll mail it to you for FREE, with the proviso that you'll experiment with it and share your experiences here.

#20 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 31 December 2010 - 09:54 AM

There's always the chance you've got a broken one - or perhaps broke it early on in the development process by sticking 5V where it didn't want to go.




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.