两侧同时换到之前的修订记录 前一修订版 | |||
5.控件详解:15.定时器控件 [2021/01/18 17:02] tjcqiu |
5.控件详解:15.定时器控件 [2021/01/18 17:13] (当前版本) tjcqiu |
||
---|---|---|---|
行 1: | 行 1: | ||
<h1 style="white-space: normal; text-align: center;">定时器控件使用说明</h1><hr/><p style="white-space: normal;"><br/></p><table><tbody><tr class="firstRow"><td width="201" valign="middle" align="center" style="word-break: break-all;">名称</td><td width="129" valign="middle" align="center" style="word-break: break-all;">操作</td><td width="90" valign="middle" align="center" style="word-break: break-all;">版本</td><td width="133" valign="middle" align="center" style="word-break: break-all;">日期<br/></td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">说明</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">编辑</td></tr><tr><td width="202" valign="middle" align="center" style="word-break: break-all;">《定时器控件使用说明》</td><td width="129" valign="middle" align="center" style="word-break: break-all;">创建中</td><td width="90" valign="middle" align="center" style="word-break: break-all;">V1.0</td><td width="133" valign="middle" align="center" style="word-break: break-all;">2019-02-18</td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">第一次编辑完成,正式发布。</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">yxj</td></tr><tr><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;" width="36">《定时器控件使用说明》</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;" width="128">修订</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">v1.1</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">2020-07-14</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;"><span style="font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);">补充本控件中所有属性详解</span></td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">qjj</td></tr></tbody></table><p style="white-space: normal;"><br/></p><hr/><p style="white-space: normal; line-height: 1.75em;"><strong>【目录】<br/></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>一、<a href="#yi" target="_self">定时器控件-概述</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>二、<a href="#er" target="_self">定时器控件-简单使用</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>三、<a href="#san" target="_self">定时器控件-属性详解</a></strong></p><p style="white-space: normal; text-indent: 2em;">3.1、<a href="#sanyi" target="_self">控件属性描述</a></p><p style="white-space: normal; text-indent: 2em;">3.2、<a href="#saner" target="_self">控件属性编辑</a></p><p style="white-space: normal; text-indent: 2em;">  3.2.1、<a href="#saneryi" target="_self">编辑属性</a>   </p><p style="white-space: normal; text-indent: 2em;">  3.2.2、<a href="#sanerer" target="_self">读属性</a></p><p style="white-space: normal; text-indent: 2em;">  3.2.3、<a href="#sanersan" target="_self">写属性</a></p><p style="white-space: normal; text-indent: 2em;">3.3 、<a href="#sansan" target="_self">属性详解</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.1、<a href="#sansanyi" target="_self">vscope属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.2、<a href="#sansaner" target="_self">objname属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.3、<a href="#sansansan" target="_self">id属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.4、<a href="#sansansi" target="_self">type属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;"><span style="text-indent: 32px;">  3.3.5、</span><a href="#sansanwu" target="_self">tim属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;"><span style="text-indent: 32px;">  3.3.6、</span><a href="#sansanliu" target="_self">en属性</a></p><p style="text-indent: 0em; white-space: normal;"><strong>四、<a href="#si" target="_self">定时器控件-使用详解</a></strong></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.1、<a href="#siyi" target="_self">在页面上新建定时器控件</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.2、<a href="#sier" target="_self">定时器实现按钮长按功能</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">4.3、</span><a href="#sisan" target="_self">定时器实现闪烁效果</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">4.4、</span><a href="#sisi" target="_self">定时器其他用途</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.5、<a href="#siwu" target="_self">定时器使用过程中常见问题</a></p><h3 style="white-space: normal;"><a name="yi"></a>一、定时器控件-概述<br/></h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.1、定时器控件是串口屏诸多功能控件里面的其中一个。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.2、定时器控件会在设定时间 每隔一段时间运行定时事件。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.3、在《USART HMI》软件左侧工具箱里面(如下图所示)。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">注:<span style="color: rgb(255, 0, 0);">定时器只能在当前页面运行不可后台运行</span>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="color: rgb(255, 0, 0);">如果想要定时器一直运行,每个页面都加个定时器</span>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="color: rgb(255, 0, 0);">定时器特有定时事件</span>。</p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594621019887745.png" title="1594621019887745.png" alt="进度条1.png"/></p><hr/><h3 style="white-space: normal;"><a name="er"></a>二、定时器控件-简单使用<br/></h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">用定时器控件,做自己的<span style="text-indent: 2em;">第一个显示工程(如下图所示)。</span></p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594622228106331.png" title="1594622228106331.png" alt="图片1.png"/></p><p style="white-space: normal; text-indent: 32px; line-height: normal; break-before: auto; break-after: auto; direction: ltr;"><span style="font-family:宋体">在当前页面数字控件n0会每隔1秒进行加一。</span></p><p style="white-space: normal; text-indent: 32px; line-height: normal; break-before: auto; break-after: auto; direction: ltr;"><span style="font-family: 宋体; font-variant-numeric: normal; font-variant-east-asian: normal; vertical-align: baseline;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594622242105858.png" title="1594622242105858.png" alt="进度条1.png"/></span></p><hr/><h3 style="white-space: normal;"><strong><a name="san"></a>三、定时器控件-属性详解</strong></h3><p style="white-space: normal; text-indent: 2em;">串口屏所有控件操作的实质都是对属性的修改。定时器控件具有的属性如下表所示。<strong><br/></strong></p><p style="white-space: normal; text-align: center;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594623441631061.png" title="1594623441631061.png" alt="进度条1.png"/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="sanyi"></a>3.1、控件属性描述</strong></p><p style="white-space: normal; text-indent: 2em;">    如下图所示,当鼠标选中对应属性时,会在属性窗口的最下方出现该属性的详细描述信息。</p><p style="white-space: normal; text-indent: 2em; text-align: center;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594623527567976.png" title="1594623527567976.png" alt="图片1.png"/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="saner"></a>3.2、控件属性编辑</strong></p><p style="white-space: normal; text-indent: 2em;">   <a name="saneryi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.1、编辑属性</span></p><p style="white-space: normal; text-indent: 2em;">  用户可以随时调整、编辑列表中的属性参数。</p><p style="white-space: normal; text-indent: 2em;">    注意:<span style="color: rgb(255, 0, 0);">type和id属性由开发环境指定,用户不可修改。id可通过软件左上角置顶置底间接修改</span>。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sanerer"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.2、读属性</span></p><p style="white-space: normal; text-indent: 2em;">  如控件属性表所示的属性,可以在设备运行中随时读取。</p><pre class="brush:cpp;toolbar:false">      sys0=tm0.id            //将定时器控件tm0的id号赋值给sys0变量 | <h1 style="white-space: normal; text-align: center;">定时器控件使用说明</h1><hr/><p style="white-space: normal;"><br/></p><table><tbody><tr class="firstRow"><td width="201" valign="middle" align="center" style="word-break: break-all;">名称</td><td width="129" valign="middle" align="center" style="word-break: break-all;">操作</td><td width="90" valign="middle" align="center" style="word-break: break-all;">版本</td><td width="133" valign="middle" align="center" style="word-break: break-all;">日期<br/></td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">说明</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">编辑</td></tr><tr><td width="202" valign="middle" align="center" style="word-break: break-all;">《定时器控件使用说明》</td><td width="129" valign="middle" align="center" style="word-break: break-all;">创建中</td><td width="90" valign="middle" align="center" style="word-break: break-all;">V1.0</td><td width="133" valign="middle" align="center" style="word-break: break-all;">2019-02-18</td><td valign="middle" colspan="1" rowspan="1" width="275" align="center" style="word-break: break-all;">第一次编辑完成,正式发布。</td><td valign="middle" colspan="1" rowspan="1" align="center" width="166" style="word-break: break-all;">yxj</td></tr><tr><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;" width="36">《定时器控件使用说明》</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;" width="128">修订</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">v1.1</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">2020-07-14</td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;"><span style="font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);">补充本控件中所有属性详解</span></td><td valign="middle" align="center" colspan="1" rowspan="1" style="word-break: break-all;">qjj</td></tr></tbody></table><p style="white-space: normal;"><br/></p><hr/><p style="white-space: normal; line-height: 1.75em;"><strong>【目录】<br/></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>一、<a href="#yi" target="_self">定时器控件-概述</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>二、<a href="#er" target="_self">定时器控件-简单使用</a></strong></p><p style="white-space: normal; line-height: 1.75em;"><strong>三、<a href="#san" target="_self">定时器控件-属性详解</a></strong></p><p style="white-space: normal; text-indent: 2em;">3.1、<a href="#sanyi" target="_self">控件属性描述</a></p><p style="white-space: normal; text-indent: 2em;">3.2、<a href="#saner" target="_self">控件属性编辑</a></p><p style="white-space: normal; text-indent: 2em;">  3.2.1、<a href="#saneryi" target="_self">编辑属性</a>   </p><p style="white-space: normal; text-indent: 2em;">  3.2.2、<a href="#sanerer" target="_self">读属性</a></p><p style="white-space: normal; text-indent: 2em;">  3.2.3、<a href="#sanersan" target="_self">写属性</a></p><p style="white-space: normal; text-indent: 2em;">3.3 、<a href="#sansan" target="_self">属性详解</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.1、<a href="#sansanyi" target="_self">vscope属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.2、<a href="#sansaner" target="_self">objname属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.3、<a href="#sansansan" target="_self">id属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;">    3.3.4、<a href="#sansansi" target="_self">type属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;"><span style="text-indent: 32px;">  3.3.5、</span><a href="#sansanwu" target="_self">tim属性</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.5em;"><span style="text-indent: 32px;">  3.3.6、</span><a href="#sansanliu" target="_self">en属性</a></p><p style="text-indent: 0em; white-space: normal;"><strong>四、<a href="#si" target="_self">定时器控件-使用详解</a></strong></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.1、<a href="#siyi" target="_self">在页面上新建定时器控件</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.2、<a href="#sier" target="_self">定时器实现按钮长按功能</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">4.3、</span><a href="#sisan" target="_self">定时器实现闪烁效果</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">4.4、</span><a href="#sisi" target="_self">定时器其他用途</a></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">4.5、<a href="#siwu" target="_self">定时器使用过程中常见问题</a></p><h3 style="white-space: normal;"><a name="yi"></a>一、定时器控件-概述<br/></h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.1、定时器控件是串口屏诸多功能控件里面的其中一个。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.2、定时器控件会在设定时间 每隔一段时间运行定时事件。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">1.3、在《USART HMI》软件左侧工具箱里面(如下图所示)。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">注:<span style="color: rgb(255, 0, 0);">定时器只能在当前页面运行不可后台运行</span>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="color: rgb(255, 0, 0);">如果想要定时器一直运行,每个页面都加个定时器</span>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="color: rgb(255, 0, 0);">定时器特有定时事件</span>。</p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594621019887745.png" title="1594621019887745.png" alt="进度条1.png"/></p><hr/><h3 style="white-space: normal;"><a name="er"></a>二、定时器控件-简单使用<br/></h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">用定时器控件,做自己的<span style="text-indent: 2em;">第一个显示工程(如下图所示)。</span></p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594622228106331.png" title="1594622228106331.png" alt="图片1.png"/></p><p style="white-space: normal; text-indent: 32px; line-height: normal; break-before: auto; break-after: auto; direction: ltr;"><span style="font-family:宋体">在当前页面数字控件n0会每隔1秒进行加一。</span></p><p style="white-space: normal; text-indent: 32px; line-height: normal; break-before: auto; break-after: auto; direction: ltr;"><span style="font-family: 宋体; font-variant-numeric: normal; font-variant-east-asian: normal; vertical-align: baseline;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594622242105858.png" title="1594622242105858.png" alt="进度条1.png"/></span></p><hr/><h3 style="white-space: normal;"><strong><a name="san"></a>三、定时器控件-属性详解</strong></h3><p style="white-space: normal; text-indent: 2em;">串口屏所有控件操作的实质都是对属性的修改。定时器控件具有的属性如下表所示。<strong><br/></strong></p><p style="white-space: normal; text-align: center;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594623441631061.png" title="1594623441631061.png" alt="进度条1.png"/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="sanyi"></a>3.1、控件属性描述</strong></p><p style="white-space: normal; text-indent: 2em;">    如下图所示,当鼠标选中对应属性时,会在属性窗口的最下方出现该属性的详细描述信息。</p><p style="white-space: normal; text-indent: 2em; text-align: center;"><img src="/dokuwiki/ueditor/php/upload/image/20200713/1594623527567976.png" title="1594623527567976.png" alt="图片1.png"/></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="saner"></a>3.2、控件属性编辑</strong></p><p style="white-space: normal; text-indent: 2em;">   <a name="saneryi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.1、编辑属性</span></p><p style="white-space: normal; text-indent: 2em;">  用户可以随时调整、编辑列表中的属性参数。</p><p style="white-space: normal; text-indent: 2em;">    注意:<span style="color: rgb(255, 0, 0);">type和id属性由开发环境指定,用户不可修改。id可通过软件左上角置顶置底间接修改</span>。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sanerer"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.2、读属性</span></p><p style="white-space: normal; text-indent: 2em;">  如控件属性表所示的属性,可以在设备运行中随时读取。</p><pre class="brush:cpp;toolbar:false">      sys0=tm0.id            //将定时器控件tm0的id号赋值给sys0变量 | ||
- |       prints tm0.tim,0       //将tm0的定时时间从串口发送出去。</pre><p style="white-space: normal; text-indent: 2em;">    注意:<span style="color: rgb(255, 0, 0);">objname属性不可以读取。比如在事件代码中写"b0.txt=tm0.objname"编译将报错</span>。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sanersan"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.3、写属性</span></p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;">  所有绿色控件可以在运行中实时修改。</span></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="sansan"></a>3.3 、属性详解</strong></p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanyi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.1、vscope属性</span></p><p style="white-space: normal; text-indent: 2em;">          vscope属性。控件内存占用属性。控件支持私有和全局属性。</p><p style="white-space: normal; text-indent: 2em;">          当设置为全局时,控件分配的内存在所有页面都可以访问。离开当前页面后,控件属性数据也不会丢失。缺点是,占用系统总内存。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansaner"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.2、objname属性</span></p><p style="white-space: normal; text-indent: 2em;">        objname属性。控件名称属性。该属性在运行中不能获取。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansansan"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.3、id属性</span></p><p style="white-space: normal; text-indent: 2em;">        id属性。控件id是每个控件在当前页面的唯一标识号。由系统分配,不可修改。(可通过软件左上角置顶置底间接修改)</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansansi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.4、type属性</span></p><p style="white-space: normal; text-indent: 2em;">        type属性。控件类型属性。由系统分别固定数据,比如定时器控件属性为5。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanwu"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.5、tim属性</span></p><p style="white-space: normal; text-indent: 2em;">        tim属性。<span style="text-indent: 32px;">定时时间,单位:ms(最小50,最大65534)。</span>在设置的时间内,每隔一段时间运行定时事件。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanliu"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.6、en属性</span></p><p style="white-space: normal; text-indent: 2em;">  en属性。使能开关:0为关闭,1为开启。</p><p style="white-space: normal; text-indent: 2em;"><br/></p><h3 style="white-space: normal;"><a name="si"></a>四、定时器控件-使用详解</h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><a name="siyi"></a><strong><span style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);">4.1</span></strong>、<strong>在页面上新建定时器控件</strong></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594687212565953.png" title="1594687212565953.png" alt="进度条1.png" width="766" height="281"/></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">点击定时器控件,他就将会出现在</span><a href="http://wiki.tjc1688.com/doku.php?id=4.%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%AF%A6%E8%A7%A3:1.%E8%BD%AF%E4%BB%B6%E7%95%8C%E9%9D%A2%E6%A6%82%E6%8B%AC,bianliangchuangkou" target="_self">特殊控件窗口</a>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">定时器是在当前页面后台运行的。(不可跨页面后台运行)当离开当前页面后定时器就不会运行。</p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;"><br/></span></p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;"><a name="sier"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.2</strong></span><strong>、定时器实现按钮长按功能</strong></span></p><p style="white-space: normal; text-indent: 2em;">①按钮控件事件设置<br/></p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019634414912.png" title="1597019634414912.png" alt="图片1.png" width="228" height="186"/><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019668129732.png" title="1597019668129732.png" alt="图片2.png" width="422" height="184"/></p><p style="white-space: normal; text-indent: 2em;">按下事件定时器开始运行,弹起事件定时器关闭运行。</p><p style="white-space: normal; text-indent: 2em;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: left;">       ②定时器控件设置<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019842129999.png" title="1597019842129999.png" alt="图片4.png"/><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594689827798669.png" title="1594689827798669.png" alt="图片4.png" width="215" height="188"/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">定时器en默认值为0(关闭),tim(定时时间)为1000ms。<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">功能说明:当按钮按够5秒的时候,控件success的值进行加1。如果按钮按的时候不足五秒,n0的值进行清零。<br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;">       <a name="sisan"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.3</strong></span><strong style="text-indent: 32px; white-space: normal;">、定时器实现闪烁效果</strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">准备两张不一样图片</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694255100289.png" title="1594694255100289.png" alt="进度条1.png" width="214" height="315"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">定时器属性设置和定时器定时事件</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694506845660.png" title="1594694506845660.png" alt="图片3.png" width="218" height="368"/><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694512937232.png" title="1594694512937232.png" alt="图片2.png" width="185" height="365"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">功能说明:50ms进行一次图片切换。也可以通过<a href="http://wiki.tjc1688.com/doku.php?id=6.%E6%8C%87%E4%BB%A4%E9%9B%86:1.%E5%9F%BA%E6%9C%AC%E6%8C%87%E4%BB%A4%E9%9B%86,vis" target="_self">vis</a>指令实现一样效果。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong style="text-indent: 32px; white-space: normal;"><br/></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong style="text-indent: 32px; white-space: normal;"><a name="sisi"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.4</strong></span><strong style="white-space: normal; text-indent: 32px;">、定时器其他用途</strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">①在主动解析模式下(<a href="http://wiki.tjc1688.com/doku.php?id=6.%E6%8C%87%E4%BB%A4%E9%9B%86:6.%E9%AB%98%E7%BA%A7%E5%BA%94%E7%94%A8%E4%B8%8E%E7%89%B9%E6%AE%8A%E6%8C%87%E4%BB%A4,b1" target="_self">什么是主动解析</a>),只有定时器能够接受串口数据并进行处理。<strong style="text-indent: 32px; white-space: normal;"><strong style="white-space: normal; text-indent: 32px;"><br/></strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">例:</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594707473879999.png" title="1594707473879999.png" alt="图片1.png" width="506" height="176"/></strong></p><p style="white-space: normal; line-height: 1.75em; text-align: left; text-indent: 2em;"><span style="text-indent: 2em;">在调试界面</span><br/></p><p style="text-indent: 2em;">选择hex发送</p><p style="text-indent: 2em;">输入对应的hex即可更换不同的图片</p><p style="text-indent: 2em;">如:</p><p style="text-indent: 2em;">黑色:55000d0a</p><p style="text-indent: 2em;">红色:55010d0a</p><p style="text-indent: 2em;">黄色:55020d0a</p><p style="text-indent: 2em;">你也可以修改演示界面中定时器中的代码来修改协议</p><p style="text-indent: 2em;">注:<span style="color: rgb(255, 0, 0);">黑色的图片id为0 <span style="text-indent: 32px;">红色的图片id为1 <span style="text-indent: 32px;">黄色的图片id为2 详情参考例程主动解析点灯</span></span></span><span style="text-indent: 32px;">。<a href="http://tjcfile.iicp.net:885/USARTHMI/demo_prj/Activeanalysis.zip" target="_self">点击下载</a></span></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">②屏幕上一些效果需要立即做出反应,可考虑使用定时器。如控件n0的值等于5的时候将sys0清零等操作。<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594711994363102.png" title="1594711994363102.png" alt="进度条1.png"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">③也可实现类似控件拖动的视觉效果(仅x系列支持),详情可参考官方出厂样例中滑动选择界面(<a href="http://wiki.tjc1688.com/doku.php?id=7.%E5%B7%A5%E7%A8%8B%E6%A0%B7%E4%BE%8B:1.%E6%A0%87%E5%87%86%E5%87%BA%E5%8E%82%E5%B7%A5%E7%A8%8B%E6%A0%B7%E4%BE%8B" target="_self">下载链接</a>)。</p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;"><strong style="text-indent: 32px; white-space: normal;">      <a name="siwu"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.5</strong></span><strong>、定时器使用过程中常见问题</strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>①定时器0里面加入使能定时器1的语句为什么不执行。</strong><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">可能原因:每次使能定时器后,时间都会从头算。定时器0定时时间设置比定时器1定时时间短。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">解决办法:定时器0中使能定时器1时先判断定时器1的状态。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">if(timer1.en==0)</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">{</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">  timer1.en=1<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">}</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>②定时器是否可以全局运行。</strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">目前定时器不支持全局运行,vscope设置全局只是为了保存一些运行修改的定时时间tim和使能开关en。如果需要全程使用到定时器运行的话,则每个界面都添加定时器和类似的代码。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>③定时器的定时时间是否能小于50ms运行。</strong></p><p style="white-space: normal; line-height: 1.75em; text-align: left; text-indent: 2em;">定时器定时时间设置范围为50—65534ms,不能设置小于50ms。目前没有办法设置小于50ms定时时间。<br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;">END</p><p><br/></p> | + |       prints tm0.tim,0       //将tm0的定时时间从串口发送出去。</pre><p style="white-space: normal; text-indent: 2em;">    注意:<span style="color: rgb(255, 0, 0);">objname属性不可以读取。比如在事件代码中写"b0.txt=tm0.objname"编译将报错</span>。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sanersan"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.2.3、写属性</span></p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;">  所有绿色控件可以在运行中实时修改。</span></p><p style="white-space: normal; text-indent: 2em;"><strong><a name="sansan"></a>3.3 、属性详解</strong></p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanyi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.1、vscope属性</span></p><p style="white-space: normal; text-indent: 2em;">          vscope属性。控件内存占用属性。控件支持私有和全局属性。</p><p style="white-space: normal; text-indent: 2em;">          当设置为全局时,控件分配的内存在所有页面都可以访问。离开当前页面后,控件属性数据也不会丢失。缺点是,占用系统总内存。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansaner"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.2、objname属性</span></p><p style="white-space: normal; text-indent: 2em;">        objname属性。控件名称属性。该属性在运行中不能获取。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansansan"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.3、id属性</span></p><p style="white-space: normal; text-indent: 2em;">        id属性。控件id是每个控件在当前页面的唯一标识号。由系统分配,不可修改。(可通过软件左上角置顶置底间接修改)</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansansi"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.4、type属性</span></p><p style="white-space: normal; text-indent: 2em;">        type属性。控件类型属性。由系统分别固定数据,比如定时器控件属性为5。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanwu"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.5、tim属性</span></p><p style="white-space: normal; text-indent: 2em;">        tim属性。<span style="text-indent: 32px;">定时时间,单位:ms(最小50,最大65534)。</span>在设置的时间内,每隔一段时间运行定时事件。</p><p style="white-space: normal; text-indent: 2em;">   <a name="sansanliu"></a> <span style="border: 1px solid rgb(0, 0, 0);">3.3.6、en属性</span></p><p style="white-space: normal; text-indent: 2em;">  en属性。使能开关:0为关闭,1为开启。</p><p style="white-space: normal; text-indent: 2em;"><br/></p><h3 style="white-space: normal;"><a name="si"></a>四、定时器控件-使用详解</h3><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><a name="siyi"></a><strong><span style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);">4.1</span></strong>、<strong>在页面上新建定时器控件</strong></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594687212565953.png" title="1594687212565953.png" alt="进度条1.png" width="766" height="281"/></p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;"><span style="text-indent: 32px;">点击定时器控件,他就将会出现在</span><a href="http://wiki.tjc1688.com/doku.php?id=4.%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%AF%A6%E8%A7%A3:1.%E8%BD%AF%E4%BB%B6%E7%95%8C%E9%9D%A2%E6%A6%82%E6%8B%AC,bianliangchuangkou" target="_self">特殊控件窗口</a>。</p><p style="white-space: normal; text-indent: 2em; line-height: 1.75em;">定时器是在当前页面后台运行的。(不可跨页面后台运行)当离开当前页面后定时器就不会运行。</p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;"><br/></span></p><p style="white-space: normal; text-indent: 2em;"><span style="text-indent: 2em;"><a name="sier"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.2</strong></span><strong>、定时器实现按钮长按功能</strong></span></p><p style="white-space: normal; text-indent: 2em;">①按钮控件事件设置<br/></p><p style="white-space: normal; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019634414912.png" title="1597019634414912.png" alt="图片1.png" width="228" height="186"/><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019668129732.png" title="1597019668129732.png" alt="图片2.png" width="422" height="184"/></p><p style="white-space: normal; text-indent: 2em;">按下事件定时器开始运行,弹起事件定时器关闭运行。</p><p style="white-space: normal; text-indent: 2em;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: left;">       ②定时器控件设置<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200810/1597019842129999.png" title="1597019842129999.png" alt="图片4.png"/><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594689827798669.png" title="1594689827798669.png" alt="图片4.png" width="215" height="188"/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">定时器en默认值为0(关闭),tim(定时时间)为1000ms。<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">功能说明:当按钮按够5秒的时候,控件success的值进行加1。如果按钮按的时候不足五秒,n0的值进行清零。<br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;">       <a name="sisan"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.3</strong></span><strong style="text-indent: 32px; white-space: normal;">、定时器实现闪烁效果</strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">准备两张不一样图片</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694255100289.png" title="1594694255100289.png" alt="进度条1.png" width="214" height="315"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">定时器属性设置和定时器定时事件</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694506845660.png" title="1594694506845660.png" alt="图片3.png" width="218" height="368"/><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594694512937232.png" title="1594694512937232.png" alt="图片2.png" width="185" height="365"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">功能说明:50ms进行一次图片切换。也可以通过<a href="http://wiki.tjc1688.com/doku.php?id=6.%E6%8C%87%E4%BB%A4%E9%9B%86:1.%E5%9F%BA%E6%9C%AC%E6%8C%87%E4%BB%A4%E9%9B%86,vis" target="_self">vis</a>指令实现一样效果。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong style="text-indent: 32px; white-space: normal;"><br/></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong style="text-indent: 32px; white-space: normal;"><a name="sisi"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.4</strong></span><strong style="white-space: normal; text-indent: 32px;">、定时器其他用途</strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">①在主动解析模式下(<a href="http://wiki.tjc1688.com/doku.php?id=6.%E6%8C%87%E4%BB%A4%E9%9B%86:6.%E9%AB%98%E7%BA%A7%E5%BA%94%E7%94%A8%E4%B8%8E%E7%89%B9%E6%AE%8A%E6%8C%87%E4%BB%A4,b1" target="_self">什么是主动解析</a>),只有定时器能够接受串口数据并进行处理。<strong style="text-indent: 32px; white-space: normal;"><strong style="white-space: normal; text-indent: 32px;"><br/></strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">例:</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594707473879999.png" title="1594707473879999.png" alt="图片1.png" width="506" height="176"/></strong></p><p style="white-space: normal; line-height: 1.75em; text-align: left; text-indent: 2em;"><span style="text-indent: 2em;">在调试界面</span><br/></p><p style="text-indent: 2em;">选择hex发送</p><p style="text-indent: 2em;">输入对应的hex即可更换不同的图片</p><p style="text-indent: 2em;">如:</p><p style="text-indent: 2em;">黑色:55000d0a</p><p style="text-indent: 2em;">红色:55010d0a</p><p style="text-indent: 2em;">黄色:55020d0a</p><p style="text-indent: 2em;">你也可以修改演示界面中定时器中的代码来修改协议</p><p style="text-indent: 2em;">注:<span style="color: rgb(255, 0, 0);">黑色的图片id为0 <span style="text-indent: 32px;">红色的图片id为1 <span style="text-indent: 32px;">黄色的图片id为2 详情参考例程主动解析点灯</span></span></span><span style="text-indent: 32px;">。<a href="http://tjcfile.iicp.net:885/USARTHMI/demo_prj/Activeanalysis.zip" target="_self">点击下载</a></span></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">②屏幕上一些效果需要立即做出反应,可考虑使用定时器。如控件n0的值等于5的时候将sys0清零等操作。<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><img src="/dokuwiki/ueditor/php/upload/image/20200714/1594711994363102.png" title="1594711994363102.png" alt="进度条1.png"/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">③也可实现类似控件拖动的视觉效果(仅x系列支持),详情可参考官方出厂样例中滑动选择界面(<a href="http://wiki.tjc1688.com/doku.php?id=7.%E5%B7%A5%E7%A8%8B%E6%A0%B7%E4%BE%8B:1.%E6%A0%87%E5%87%86%E5%87%BA%E5%8E%82%E5%B7%A5%E7%A8%8B%E6%A0%B7%E4%BE%8B" target="_self">下载链接</a>)。</p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;"><br/></p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em;"><strong style="text-indent: 32px; white-space: normal;">      <a name="siwu"></a><span style="text-indent: 2em; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"><strong>4.5</strong></span><strong>、定时器使用过程中常见问题</strong></strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>①定时器0里面加入使能定时器1的语句为什么不执行。</strong><br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">可能原因:每次使能定时器后,时间都会从头算。定时器0定时时间设置比定时器1定时时间短。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">解决办法:定时器0中使能定时器1时先判断定时器1的状态。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">if(timer1.en==0)</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">{</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">  timer1.en=1<br/></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">}</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>②定时器是否可以全局运行。</strong></p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;">目前定时器不支持全局运行,vscope设置全局只是为了保存一些运行修改的定时时间tim和使能开关en。如果需要全程使用到定时器运行的话,则每个界面都添加定时器和类似的代码。</p><p style="white-space: normal; line-height: 1.75em; text-indent: 2em;"><strong>③定时器的定时时间是否能小于50ms运行。</strong></p><p style="white-space: normal; line-height: 1.75em; text-align: left; text-indent: 2em;">定时器定时时间设置范围为50—65534ms,不能设置小于50ms。目前没有办法设置小于50ms定时时间。</p><p style="text-indent: 0em; white-space: normal; line-height: 1.75em; text-align: center;">END</p><p><br/></p> |