A dynamic refresh method of data communication, which is characterized in that: firstly, according to the container and the height of the font size of the display, the display can display the calculated maximum line number N in the container, and then set the dynamic parameters of N, n to display the container is currently the number of rows displayed, when the communication data packet when the communication data packet into can display a row in the container to display information stored in data communication buffer, adds the value of N 1, to determine whether the n is greater than or equal to N, such as, clear display all display information displayed in the container, and then set the value of n as 1, if not, then display information is displayed on the display in a container blank line. Compared with the prior art, the invention has the advantages that it can effectively reduce the normal communication time to refresh the display of the information consumption, at least to 3 ~ 5ms, the communication between the PC and the needs of most.
【技术实现步骤摘要】
一种通信数据的动态刷新方法
本专利技术涉及一种通信数据的动态刷新方法。
技术介绍
上位机与下位机进行通信时,需要在上位机中实时显示通信数据。上位机中显示通信数据的文本框或其他显示容器的高度是有限制的,因此为了观察实时的通信数据,需要对通信数据进行动态刷新,使得当前或最近几个数据包显示在显示容器的显示范围内。现有的通信数据的动态刷新方式为:上位机接收到新的数据包后,会将显示容器中之前的一个数据往上或往下移动一行,然后将新增的数据包添加至空行中,这种传统的通信数据刷新方式的缺点是消耗较多的时间(约40-60ms),而数据包之间的时间间隔有时仅为100ms,这将导致系统的性能变差,甚至影响通信数据的正常收发。
技术实现思路
本专利技术所要解决的技术问题是针对上述现有技术提高一种可有效减少正常通信时刷新显示数据的时间消耗的通信数据的动态刷新方法。本专利技术解决上述技术问题所采用的技术方案为:一种通信数据的动态刷新方法,其特征在于:首先根据显示容器的高度和显示字体的大小,计算当前显示容器中可以显示的最大行数N,然后设置动态参数n,n表示为显示容器中当前已经显示的行数,当有新的通 ...
【技术保护点】
一种通信数据的动态刷新方法,其特征在于:首先根据显示容器的高度和显示字体的大小,计算当前显示容器中可以显示的最大行数N,然后设置动态参数n,n表示为显示容器中当前已经显示的行数,当有新的通信数据包时,通过如下步骤将新的通信数据包显示在显示容器中:步骤一、将新的通信数据包转换成能在显示容器中的一行进行显示的显示信息;步骤二、将步骤一转换后的显示信息存入通信数据缓存区;步骤三、将n的值加1;步骤四、判断n是否大于等于N,如是,执行步骤五;如不是,执行步骤六;步骤五、清空显示容器中显示的所有显示信息,然后将n的值设为1,然后执行步骤六;步骤六、将步骤一转换后的显示信息在显示容器中的空白行进行显示。
【技术特征摘要】
1.一种通信数据的动态刷新方法,其特征在于:首先根据显示容器的高度和显示字体的大小,计算当前显示容器中可以显示的最大行数N,然后设置动态参数n,n表示为显示容器中当前已经显示的行数,当有新的通信数据包时,通过如下步骤将新的通信数据包显示在显示容器中:步骤一、将新的通信数据包转换成能在显示容器中的一行进行显示的显示信息;步骤二、将步骤一转换后的显示信息存入通信数据缓存区;步骤三、将n的值加1;步骤四、判断n是否大于等于N,如是,执行步骤五;如不是,执行步骤六;步骤五、清空显示容器中显示的所有显示信息,然后将n的值设为1,...
【专利技术属性】
技术研发人员:邓炜兴,沈伟,茅忠群,诸永定,方献良,
申请(专利权)人:宁波方太厨具有限公司,
类型:发明
国别省市:浙江,33
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。