3wall-mountedprogrammablekeyboard, 41 pgmⅢ programmable ethernet control system – CREATOR CR-PGMIII User Manual
Page 48

CREATOR CHINA 2011-03
WWW.CREATOR1997.COM
41
PGMⅢ Programmable Ethernet Control System
7.9.3
Wall-mounted
Programmable
keyboard
DEFINE_DEVICE
CRNET_RELAY= N:6:RELAY;
//define relay with the ID number of 6
CRNET_WallBoard
= N:9:WM;
//define
the wall-mounted programmable keyboard with
the ID of 9
DEFINE_EVENT
//
the
wall-mounted
programmable
keyboard’s (CRNET_WallBoard) first way return
data is to control ON/OFF of the relay:
CRNET_RELAY
//correspond to the DATA of the wall-mounted
programmable control keyboard. Data[0]==1
means being pressed down; == 0 means
bouncing back; DATA. Data is the returned
character array.
DATA_EVENT(CRNET_WallBoard,1)
{
ONDATA()
{
TRACE(“recive
data
from
zhu
gong”);
//////DATA.
Data
is
returned
character array from the com port//Note: currently
doesn’t support 0x8 display
if(DATA. Data[0]==1)
{
ON_RELAY(CRNET_RELAY,1);
//ON_VOL(CRNET_VOL_01);
//SET_VOLTOTOL(CRNET_VOL_01,”56666
”);
}
else if(DATA. Data[0]==0)
{
OFF_RELAY(CRNET_RELAY,1);
}
}
}
//same as above, the 2
nd
way
DATA_EVENT(CRNET_WallBoard,2)
{
ONDATA()
{
TRACE(“receive data from zhu
gong”);
//DATA. Data is the returned data
from the COM interface, displayed in
character array. Note: 0x8 is not
supported currently
if(DATA. Data[0]==1)
{
ON_RELAY(CRNET_RELAY,2);
//ON_VOL(CRNET_VOL_01);
//SET_VOLTOTOL(CRNET_VOL_01,”56666
”);
}
else if(DATA. Data[0]==0)
{
OFF_RELAY(CRNET_RELAY,2);
}
}
}
//same as above, 3
rd
way
DATA_EVENT(CRNET_WallBoard,3)
{
ONDATA()
{
TRACE(“recive
data
from
zhu
gong”);
//DATA. Data is the
returned data from the COM interface,