
TPD/VPD Series – Programming Guide v.1.0.6
Page 46
Copyright@ 2020 ICP DAS CO., LTD. All Rights Reserved. E-mail: [email protected]
Step 10: Edit the control codes for the Button component.
a.
Double click the “CheckBox6” component in the design area to open the programming
window.
b.
Edit the code in the programming window using the C language. (Users can copy the
code from the picture below.)
c.
When finished, click “OK” to store.
Step 11: Build and Download the demo to the TouchPAD model.
Please refer
Downloading Methods for TouchPAD
HANDLE h;
char ReadDI_value[1];
int NetID = 1;
int addr = 0;
int ch_count = 8;
char DO_value[1];
void Frame12OnCreate()
{
h = uart_Open("COM1,9600,N,8,1");
}
void Frame12OnDestroy()
{
uart_Close(h);
}
void Timer8OnExecute(tWidget *pWidget)
{
mrm_ReadDI (h, NetID, addr, ch_count, ReadDI_value);
if (ReadDI_value[0] == 1) CheckBoxSelectedSet(&CheckBox4, 1);
else CheckBoxSelectedSet(&CheckBox4, 0);
}
void CheckBox6OnChange(tWidget *pWidget, unsigned long bSelected)
{
if(bSelected) DO_value[0] = 1;
else DO_value[0] = 0;
mrm_WriteDO (h, NetID, addr, ch_count, DO_value);
}
Declare the related
variables of DO.
Send the control message
when the User clicks the
button.
b.
c.