中级会员
 
- 积分
- 265
- 金钱
- 265
- 注册时间
- 2012-11-29
- 在线时间
- 5 小时
|

楼主 |
发表于 2013-1-13 14:47:34
|
显示全部楼层
void Send_data(void)
{ uchar buf[200],str[200];
int b=1090,a=99999999;
int i;
for(i=0;i<100;i++)
{
b++;
a--;
Delay(500);
sprintf(buf,"%d",b);
sprintf(str,"%d",a);
SetTextValue(2,3,buf);
SetTextValue(2,4,str);
SetTextValue(2,5,buf);
SetTextValue(2,6,str);
SetTextValue(2,7,buf);
}
}
/****************************************************************************
* 名 称: SetTextValue() char buf[20];
sprintf(buf,"%d",100);
SetTextValue(2,3,buf);
* 功 能: 设置文本控件的显示文字
* 入口参数: screen_id,控件所在的画面ID
* 入口参数: control_id,目标控件ID
* 入口参数: str,显示文字
* 出口参数: 无
****************************************************************************/
void SetTextValue(uint16 screen_id,uint16 control_id,uchar *str)
{
uint16 len = 0;
uchar *p = str;
while(*p++) ++len;
SetControlValue(screen_id,control_id,str,len);
}
//static void SetProg_Meter_Slider_Value(uint16 screen_id,uint16 control_id,uint32 value)
//{
//
// SendBeginCMD();
// USART1_SendByte(0xb1);
// USART1_SendByte(0x10);
//
// USART1_SendByte(screen_id>>8);
// USART1_SendByte(screen_id&0xff);
//
// USART1_SendByte((control_id>>8));
// USART1_SendByte((control_id&0xff));
//
// USART1_SendByte((value>>24)&0xff);
// USART1_SendByte((value>>16)&0xff);
// USART1_SendByte((value>>8)&0xff);
// USART1_SendByte((value&0xff));
//
// SendEndCmd();
//}
/****************************************************************************
* 名 称: SetControlValue()
* 功 能: 设置控件的数值
* 入口参数: screen_id,控件所在的画面ID
* 入口参数: control_id,目标控件ID
* 入口参数: param,设置参数
* 入口参数: param_len,参数长度
* 出口参数: 无
****************************************************************************/
static void SetControlValue(uint16 screen_id,uint16 control_id,uchar *param,uint16 param_len)
{
uint16 i = 0;
USART1_SendByte(0xEE);
USART1_SendByte(0xb1);
USART1_SendByte(0x10);
USART1_SendByte(screen_id>>8);
USART1_SendByte(screen_id&0xff);
USART1_SendByte((control_id>>8));
USART1_SendByte((control_id&0xff));
for (i=0;i<param_len;++i)
{
USART1_SendByte(param);
}
USART1_SendByte(0xFF);
USART1_SendByte(0xFC);
USART1_SendByte(0xFF);
USART1_SendByte(0xFF);
}
> |
|