Main Site Documentation

LCD.Configurations problem with older screen on NET MF 4.2


#1

Hi. I have an EMX project and before moving to 4.2 my display was working fine. Now it’s not doing so well. I’m using this display:

https://www.ghielectronics.com/catalog/product/240

and the SetLCDConfigurations code below:

The problem is that although this is a 320x240 display (at least I thought it was) … the GHI text such as… “ing for debug commands…” is mostly off the top left of the screen.

Does anyone know the correct LCD Configuration for this old screen?

Thank you.

static void SetLCDConfigurations()
{
Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
lcdConfig.Width = 320;
lcdConfig.Height = 240;

// Only use if needed, see documentation.
//lcdConfig.PriorityEnable = false;

lcdConfig.OutputEnableIsFixed = true;
lcdConfig.OutputEnablePolarity = true;
lcdConfig.HorizontalSyncPolarity = false;
lcdConfig.VerticalSyncPolarity = false;
lcdConfig.PixelPolarity = false;
lcdConfig.HorizontalSyncPulseWidth = 41;
lcdConfig.HorizontalBackPorch = 2;
lcdConfig.HorizontalFrontPorch = 2;
lcdConfig.VerticalSyncPulseWidth = 10;
lcdConfig.VerticalBackPorch = 2;
lcdConfig.VerticalFrontPorch = 2;

// NOTE: This is used for EMX
//lcdConfig.PixelClockDivider = 8;
lcdConfig.PixelClockRateKHz = 8; // I added this. Without it the display does not work (solid white screen).

// Set config
if (Configuration.LCD.Set(lcdConfig))
{
// New settings were saved, must reboot
Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
}
}


#2

After the above code, if I do a DrawTextInRect at 0, 0 and draw “Hello World!”, then I can see the bottom half of “World!” at the top left of my screen.


#3

If you mess with back and front porch you will get it to work. Basically add one and take note of what you see. Each increment should move it by one pixel.


#4

Thanks Gus!

For anyone else who needs it, the settings that worked for me are below. Additionally, drawing a rectangle via something like:

        LCD.DrawLine(Colors.Cyan, 1, 0, 0, 319, 0);
        LCD.DrawLine(Colors.Cyan, 1, 0, 0, 0, 239);
        LCD.DrawLine(Colors.Cyan, 1, 0, 239, 319, 239);
        LCD.DrawLine(Colors.Cyan, 1, 319, 0, 319, 239);

makes quick work of finding the correct settings.

            lcdConfig.OutputEnableIsFixed = true;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;
            lcdConfig.PixelPolarity = false;
            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch = 27;
            lcdConfig.HorizontalFrontPorch = 2;
            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch = 8;
            lcdConfig.VerticalFrontPorch = 2;