HANDLE h;
int NetID = 1;
int addr = 0;
int ch_count = 7;
WORD AI_value[7];
tLabel * date_time[7];
static char date_time_str[7][5];
//One static char array for one label;
//data array must be static for widget painting

void Frame12OnCreate()
{

  h = uart_Open("COM1,19200,N,8,1");  //Only support for COM1

  date_time[0] = &Year4;
  date_time[1] = &Month5;
  date_time[2] = &Day6;
  date_time[3] = &Week7;
  date_time[4] = &Hour8;
  date_time[5] = &Minute9;
  date_time[6] = &Second10;
}

void Timer11OnExecute(tWidget *pWidget)
{
  int i = 0;
  BOOL ret = 0;

  ret = mrm_ReadAI (h, NetID, addr, ch_count, AI_value);

  if(ret)
  {
    for(i = 0; i < 7; i++)
    {
      usprintf(&date_time_str[i][0], "%d", AI_value[i]);
      LabelTextSet(date_time[i], &date_time_str[i][0]);
    }
  }
}


void Frame12OnDestroy()
{
   uart_Close(h);
}




