1显示数据

typedef struct
{
unsigned long int mL_data;
unsigned long int L_data;
unsigned long int M3_data;
}water_date;
extern water_date water_data1;

2数据处理函数

/**---------------------------------------------------------------------------------
* @brief 数据处理函数
* @param 无
* @arg 需处理数据结构体起始地址
* @retval 数据起始地址
---------------------------------------------------------------------------------*/
unsigned char* DATA_DEAL(water_date t)
{
unsigned char DIS_DATA[] = {"000mL;000L;000M3"};
if(t.mL_data || t.L_data || t.M3_data)
{
DIS_DATA[] = (t.mL_data * /)%/ + 0x30;
DIS_DATA[] = (t.mL_data * /)%/ + 0x30;
DIS_DATA[] = (t.mL_data * /)% + 0x30; DIS_DATA[] = t.L_data%/ + 0x30;
DIS_DATA[] = t.L_data%/ + 0x30;
DIS_DATA[] = t.L_data% + 0x30; DIS_DATA[] = t.M3_data%/ + 0x30;
DIS_DATA[] = t.M3_data%/ + 0x30;
DIS_DATA[] = t.M3_data% + 0x30; return DIS_DATA;
}
else return ; }

3显示函数

/**---------------------------------------------------------------------------------
* @brief 对应位置显示函数
* @param y:1,2(从第几行开始写)
x:0-15(从改行的第几位开始写)
* @arg NULL
* @retval null
---------------------------------------------------------------------------------*/
unsigned char LCD1602_WRITE(unsigned char y,unsigned char x,unsigned char *write_data)
{
unsigned char i;
lcd_wcmd(0x06); //向右移动光标
if(y == )
{
lcd_pos(x); //设置显示位置为第一行的第1个字符
i = ;
while(*(write_data + i) != '\0')
{ //显示字符"WLCOME TO"
lcd_wdat(*(write_data + i));
i++;
// delay(200); //控制两字之间显示速度
if(i > )
{
LCE1602_STATUS = WRITE_NO;
return LCE1602_STATUS;
}
}
LCE1602_STATUS = WRITE_OK;
return LCE1602_STATUS;
}
else
{
lcd_pos(0x40 + x); //设置显示位置为第一行的第1个字符
i = ;
while(*(write_data + i) != '\0')
{ //显示字符"WLCOME TO"
lcd_wdat(*(write_data + i));
i++;
// delay(200); //控制两字之间显示速度
if(i > )
{
LCE1602_STATUS = WRITE_NO;
return LCE1602_STATUS;
}
}
LCE1602_STATUS = WRITE_OK;
return LCE1602_STATUS;
}
}
05-11 20:07