Hi all
I have been pondering over the lcd 03. using C#2010 pro I am trying and have been for 2 weeks to make a bar graph showing current (Live) cpu status.
here is my code...
private void button13_Click(object sender, EventArgs e)
{
string cpu = "CPU:";
// byte user_char = 255;
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 4;
SerBuf[4] = 12;
SerBuf[5] = 03;
SerBuf[6] = 2;
SerBuf[7] = 1;
Write(8);
Read(1);
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = (byte)cpu.Length;
byte[] TempBuf1 = Encoding.ASCII.GetBytes(cpu);
for (int x = 0; x < cpu.Length; x++) SerBuf[x + 4] = TempBuf1[x];
Write(cpu.Length + 4);
Read(1);
int bars;
int balance;
int bargraph;
int percent;
int i;
int bwidth = 16;
int maxbar = bwidth * 3;
int a = 1;
while (a < 1000)
{
a++;
bargraph = (int)(performanceCounter1.NextValue());
percent = (bargraph / 3);
bars = percent /3;
balance = percent % 3;
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 3;
SerBuf[4] = 03;
SerBuf[5] = 2;
SerBuf[6] = 5;
Write(7);
Read(1);
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 1;
SerBuf[4] = 255;
for (i = 0; i < bars; i++) ;
Write(5);
Read(1);
switch (balance)
{
case 0:
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 1;
SerBuf[4] = 17;
Write(5);
Read(1);
break;
case 1:
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 1;
SerBuf[4] = 255;
Write(5);
Read(1);
break;
case 2:
SerBuf[0] = 0x55;
SerBuf[1] = 0xC6;
SerBuf[2] = 0;
SerBuf[3] = 1;
SerBuf[4] = 255;
Write(5);
Read(1);
break;
}
Thread.Sleep(100);
}
I have it running but it does not update any more than 2 Cells of the LCD and not 1 - 16 as required. I have gone "Code Blind" from staring at it for so long. Any help would be appreciated.
I have seen that some LCD's are smart and have graphicg capabilities, does this one? Thanks again Chris
