Main Site Documentation

Touch Issue with 7 inch LCD


I am working with FEZ cobra-7 LCD. I am trying to run GHI Graphical Demo code on 7 LCD. I have done the calibration settings as per 7 LCD.

I am facing touch issue with some of the screens. The desktop.cs is working properly whereas the internal screens like touch demo are not responding properly. For example if I press Exit button sometimes, it is not executing properly. I have check through debug option, but it gives wrong X and Y coordinates value.

The code is working properly with 4.3 LCD. Can someone guide for solution?


Are you using a stylus in your test?


yes, I am using stylus and i have checked with finger too. Both are not working.


There is an example found in “my documents” on your PC that does calibration and then draws a point on where you touch. Maybe try it to get a better idea. Maybe you didn’t align the touch properly.


I have tried with the example, surprisingly it behaving differently in all three segments (Top segment, Middle segment and Bottom segment). In Top segment, it is giving more difference stylus, in middle segment it is less and in bottom segment it is perfect.

For better view i have uploaded the video, please go through below link and let me know the solution.


But did you calibrate?


I think Gus is right, it looks like it’s just calibration that needs to scale things out to a more correct location.


I have used below calibration settings available with 7" LCD configuration code, but this is giving problem.

        static void SetLCDConfigurations()
            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
            lcdConfig.Width = 800;
            lcdConfig.Height = 480;

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

            lcdConfig.OutputEnableIsFixed = false;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity = false;
            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;

            // For EMX
            lcdConfig.HorizontalSyncPulseWidth = 150;

            // On ChipworkX, there is a limited range for the HorizontalSyncPulseWidth. Set it to 60 instead.
            // lcdConfig.HorizontalSyncPulseWidth = 60;

            lcdConfig.HorizontalBackPorch = 150;
            lcdConfig.HorizontalFrontPorch = 150;
            lcdConfig.VerticalSyncPulseWidth = 2;
            lcdConfig.VerticalBackPorch = 2;
            lcdConfig.VerticalFrontPorch = 2;
            lcdConfig.PixelClockDivider = 5;

            // Set config
            if (Configuration.LCD.Set(lcdConfig))
                // New settings were saved, must reboot

            const int CAL_POINTS = 5;
            short[] sx = new short[CAL_POINTS] { 400, 80, 80, 720, 720 };
            short[] sy = new short[CAL_POINTS] { 240, 48, 432, 432, 48 };
            short[] cx = new short[CAL_POINTS] { 510, 159, 160, 846, 855 };
            short[] cy = new short[CAL_POINTS] { 494, 233, 765, 754, 236 };
            Microsoft.SPOT.Touch.Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);


No that code is to setup the display and not calibrate it.


Thanks for the reply.

I have prepared a class which calibrate LCD. I have called this class from Program.cs and from calibration class, i have open my application but still it is not giving proper data.

I have check with “TouchCalibration” in the sample example available from microsoft. It runs properly.

Can someone share the code that how to calibrate first and then start our application which work properly in 7" LCD?


The very Microsoft example does it.

calibration = you see 5 cross-hair where you touch them to calibrate.


Thanks GUS, I have done the calibration with one of the reference example and it works properly. It was one silly mistake in calibration which was occurring the problem.