![ICP DAS USA TouchPAD TPD Series Скачать руководство пользователя страница 36](http://html1.mh-extra.com/html/icp-das-usa/touchpad-tpd-series/touchpad-tpd-series_programming-manual_3682250036.webp)
TPD/VPD Series - Getting Started v.1.0.5
Page 32
Copyright@ 2012 ICP DAS CO., LTD. All Rights Reserved. E-mail: [email protected]
Step 9: Edit the control codes for the “Timer” component.
a.
Double click the “Timer6” component in the design area to open the programming
window.
b.
Edit the code in the programming window using the C language. (The User can copy
the code from the picture below.) In this demo, the counter will increase by 1 each
time the button is clicked until it reaches 100, and will then reset to 0 before
beginning to accumulate again.
c.
When finished, click “Save & Close” from the “File” menu.
Step 10: The configuration for Demo 1 has been completed. Click [File] > [Save] to
save the file.
long cnt1=0;
long auto_cnt1=0;
static char str1[32];
void Timer6OnExecute(tWidget *pWidget)
{
auto_cnt1=au1;
if (auto_cnt1>100)
{
auto_cnt1=0;
}
usprintf(str1,"%d",auto_cnt1);
LabelTextSet(&
LabelWidget7
, str1);
}
b.
Convert the integer to a
string in order to display it
on the Label.
Declare the variable
(auto_cnt1)
This name must be the same as “Name”
and “ID” properties of the Label.