#include "gd32e23x.h"
#include "systick.h"
#include <stdio.h>

#include <led.h>
#include <delay.h>
#include <usart.h>
#include <stdlib.h>

uint32_t USART0_RECEIVE_Buf[100]; 
uint32_t USART1_RECEIVE_Buf[100]; 

#define MAX_TABLE_CHAR 5
#define TABLE_RECORD_ADDR 0
extern unsigned char val[];
int main(void)
{
  int  i,k;
  unsigned char ret;
  char buf[128];
  char va[19];

  char mode=1;//run mode as default
  char code_table[MAX_TABLE_CHAR];
  unsigned char key=0xff;
  unsigned char data_h,data_l;
  unsigned short data;
  unsigned char p[8];
  systick_config();   
  USART0_Init();
  Delay_ms(500);
	
while(1)
{
   
			
				for(int k=0;k<=59;k++)
				
			 {
				 if (k<=9)
			   sprintf(buf,"SET_TXT(4,'0%d');\r\n",k);
				 else
				 sprintf(buf,"SET_TXT(4,'%d');\r\n",k);
				 UartSend(buf);
				 Delay_ms(1000);
				 CheckBusy();
			 			 			 
			   {
					 p[0]=rand()%10000;
					 p[1]=rand()%1000;
					 p[2]=rand()%100;

					 sprintf(buf,"SET_TXT(0,'%d');SET_TXT(1,'%d');SET_TXT(2,'%d');\r\n",p[0],p[1],p[2]);
					}
		  UartSend(buf);
		  CheckBusy();	 
		  Delay_ms(300);
			
			
			 }
  }		 

}