The code below compiles and runs, but it is doing weird text print out. I moved the InitGraphics() before doing the thread start, that seem to solve the exception errors. The program is not running the way I expected it to run. Maybe the processor is to slow, but at least I did figure out how to run a thread. Any suggestions for fixing the way the text gets printed to the screen? Now it seems like I am getting garbage characters on the screen.
[CODE]
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
namespace BaseCard
{
public class Program
{
static FEZ_Components.FEZTouch fezTouch;
static FEZ_Components.FEZTouch.Font defaultFont;
public static void Main()
{
Thread dtThread = new Thread(new ThreadStart(TimeDate));
// Start this first
InitGraphics();
dtThread.Start();
// x y
fezTouch.DrawString(0, 12, "BaseCard Program", FEZ_Components.FEZTouch.Color.Yellow,
FEZ_Components.FEZTouch.Color.Black, defaultFont);
fezTouch.DrawString(120, 24, "AA", FEZ_Components.FEZTouch.Color.Yellow,
FEZ_Components.FEZTouch.Color.Black, defaultFont);
while (true)
{
fezTouch.DrawString(0, 32, "Test Line. ", FEZ_Components.FEZTouch.Color.Yellow,
FEZ_Components.FEZTouch.Color.Black, defaultFont);
}
}
public static void TimeDate()
{
DateTime DT;
lock (fezTouch)
{
while (true)
{
Thread.Sleep(10);
DT = RealTimeClock.GetTime();
fezTouch.DrawString(140, 0, " " + DT, FEZ_Components.FEZTouch.Color.Yellow,
FEZ_Components.FEZTouch.Color.Black, defaultFont);
// fezTouch.DrawString(0, 12, "ZZ", FEZ_Components.FEZTouch.Color.Yellow,
// FEZ_Components.FEZTouch.Color.Black, defaultFont);
}
}
}
public static void InitGraphics()
{
// create lcd configuration for FEZ Panda II
FEZ_Components.FEZTouch.LCDConfiguration lcdConfig = new FEZ_Components.FEZTouch.LCDConfiguration(
FEZ_Pin.Digital.Di28,
FEZ_Pin.Digital.Di20,
FEZ_Pin.Digital.Di22,
FEZ_Pin.Digital.Di23,
new FEZ_Pin.Digital[8] { FEZ_Pin.Digital.Di51, FEZ_Pin.Digital.Di50, FEZ_Pin.Digital.Di49, FEZ_Pin.Digital.Di48, FEZ_Pin.Digital.Di47, FEZ_Pin.Digital.Di46, FEZ_Pin.Digital.Di45, FEZ_Pin.Digital.Di44 },
FEZ_Pin.Digital.Di24,
FEZ_Pin.Digital.Di26,
FEZ_Components.FEZTouch.Orientation.Landscape
);
// create touch configuration for FEZ Panda II
FEZ_Components.FEZTouch.TouchConfiguration touchConfig = new FEZ_Components.FEZTouch.TouchConfiguration(SPI.SPI_module.SPI2, FEZ_Pin.Digital.Di25, FEZ_Pin.Digital.Di34);
// create fez touch
fezTouch = new FEZ_Components.FEZTouch(lcdConfig, touchConfig);
// create font for text
defaultFont = new FEZTouch.Fonts.FontCourierNew10();
// clear the screen
fezTouch.ClearScreen();
}
}
}
[/CODE]