I need the code to run my 2x16 LCD (Arduino) to a microcontroller Fez Panda 2 with shema of connections.
Sorry for my bad english, I’m French
Here are my no-functional code :
using System;
using Microsoft.SPOT;
using GHIElectronics.NETMF.FEZ;
using System.Threading;
namespace lcd
{
public class Program
{
public static void Main()
{
SerialLCDDisplay lcd = new SerialLCDDisplay(
FEZ_Pin.Digital.Di21, // RS
FEZ_Pin.Digital.Di23, // ENABLE
FEZ_Pin.Digital.Di25, // DB4
FEZ_Pin.Digital.Di27, // DB5
FEZ_Pin.Digital.Di29, // DB6
FEZ_Pin.Digital.Di31); // DB7
lcd.Clear();
int i = 0;
while (true)
{
lcd.CursorHome();
lcd.Print("Counter " + i++);
Thread.Sleep(100);
}
}
The other thing I would do is change your 100ms delay to be 10,000 (10sec) so you get to see a real displayed value and know it’s working - all that change in your current program may not be visible.
What do you actually see on the display? Have you adjusted the contrast correctly, have you got all the other pins wired correctly ?
using System;
using Microsoft.SPOT;
using GHIElectronics.NETMF.FEZ;
using System.Threading;
namespace lcd
{
public class Program
{
public static void Main()
{
FEZ_Components.LCD2x16 lcd = new FEZ_Components.LCD2x16
(FEZ_Pin.Digital.Di21, FEZ_Pin.Digital.Di23, FEZ_Pin.Digital.Di25,
FEZ_Pin.Digital.Di27, FEZ_Pin.Digital.Di29, FEZ_Pin.Digital.Di31);
lcd.Clear();
int i = 0;
while (true)
{
lcd.CursorHome();
lcd.Print("Counter " + i++);
Thread.Sleep(10000);
}
}
}
}
You really need a variable resistor to control the contrast on these types of displays. There’s a good chance that the display is working but you just can’t see the output.
Hitachi HD44780 LCD controller - Wikipedia has the information on this type of display. Pin 3 is the one you need to connect your contrast control resistor to. You then need to adjust it to get the cells visible. Also make sure you use 5v as your power source, since I’ve seen many LCDs that don’t work reliably on 3v3 (I can’t tell from your picture if you have used 3v3 or 5v).
Connecting it to a Panda is no different to connecting it to an arduino. In your code, you have defined what connections you have used in the constructor of the LCD object, you need to match the pin’s function there with the physical wiring. Make sure you match them up because if you get them wrong they won’t work properly If you take more detailed shots of your wiring we might be able to guide you there if you need.